SharePoint Full Farm Site Collection Admin report

93

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
}

Share this entry

Leave a Reply

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

Table of Contents

Categories

Categories