SharePoint Full Farm Site Collection Admin report

Reporting on SharePoint Full Farm Site Collection Admins

Site Collection Administrators retain a great deal of power and capability within a SharePoint Site Collection. Wouldn’t it be nice to know are the Site Collection admins across an entire farm? This script will generate a report that is easily loaded and pivoted in Excel. First, let’s pick a column separator that’s not in use by any of the fields. This is a bit of a challenge, because with Claims based authentication, there’s quite a few characters in use that precludes them being a separator. Here’s the script:

$Sep="~"
Write-Host "WebApp$($sep)SiteCollection$($sep)UserName$($sep)UserLogin"
$spWebApps = get-spwebapplication 
foreach ($spWebApp in $spWebApps)
{
foreach($site in $spWebApp.Sites)
{
foreach($siteAdmin in $site.RootWeb.SiteAdministrators)
{
Write-Host "$($spWebApp.Name)$($sep)$($siteAdmin.ParentWeb.Url)$($sep)$($siteAdmin.DisplayName)$($sep),$($siteAdmin.UserLogin)"
}
$site.Dispose()
}
$spWebApp=$null; #this is not an IDisposable object
}
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *