Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
PowerShell Script To Get System Account Of A Web Application
WhatsApp
Abhay Shanker
11y
6.2
k
0
0
25
Blog
The mentioned below script explains how to get the System Account of a Web Application in the SharePoint using a PowerShell script.
$
farmWebAppService
= (Get-SPFarm).Services | ? { $_.typename -eq "Microsoft SharePoint Foundation Web Application" }
foreach($webApp in $farmWebAppService.WebApplications)
{
Write-Host "Web Application: " $webApp.Name
$
collection
= @()
foreach ($zonepol in $webApp.Policies)
{
if($zonepol.IsSystemUser -eq $true)
{
$collection += $zonepol;
}
}
if($collection.Count -eq 0)
{
Write-Host "System Account (application pool account): " $webApp.ApplicationPool.DisplayName " - " $webApp.ApplicationPool.Username
}
else
{
foreach($item in $collection)
{
Write-Host "System Account (policy setting): " $item.DisplayName " - " $item.UserName
}
}
}
PowerShell script to get System Account of a Web Application
People also reading
Membership not found