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
- }
- }
- }

Join the conversation! Your thoughts help the community grow.