Site Collection Administrators Report for All SharePoint 2007 Sites

I just had to generate a report to find SharePoint site collection administrators and see who are all assigned with Site collection administrator rights on various site collections in the entire SharePoint Farm.

Sure, let’s use PowerShell in SharePoint to get site collection administrator programmatically. This script iterates through all site collections in all web applications to list site collection administrators.

PowerShell Script to Get All Site Collection Administrators

I have made it compatible with SharePoint 2007


#Get the Farm
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local

#Get All Web Applications
$farmWebServices = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
foreach ($farmWebService in $farmWebServices) {
 #Loop through Each web applicatoin
  foreach ($webApplication in $farmWebService.WebApplications) {
    #Loop through each site collection
    foreach ($site in $webApplication.Sites)
       #Get all Site Collection Administrators
       foreach ($siteCollAdmin in $site.RootWeb.SiteAdministrators)
           $Admins+= $siteCollAdmin.LoginName +";"
        Write-Host "Site URL: " $site.RootWeb.Url " - Site Collection Admins: " $Admins "`n"

By the way, It works on SharePoint 2010 and SharePoint 2013 as well.

To get all site collection administrators in SharePoint Online, use: SharePoint Online: PowerShell to Get All Site Collection Administrators

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

5 thoughts on “Site Collection Administrators Report for All SharePoint 2007 Sites

Leave a Reply

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