Get All SharePoint Site Collection Owners (Primary/Secondary Site Collection Administrators)

Requirement is to find out owners of each SharePoint site collection in the environment.We needed this data to get approvals on critical changes and to inform site owners prior to maintenance windows.

Simple! Use STSADM command:
On SharePoint 2007 and above, STSADM command can be used to get primary owner details of site collections:
Syntax:
stsadm -0 enumsites -url <web-app-url>
E.g.
stsadm -0 enumsites -url “https://sharePoint.crescent.com” > SitesRpt.xml

This command enumerates all site collections and pulls site owner information. It also retrieves secondary owner, content database in which site collection exist and storage details of the site collection. Just open the generated XML file with Microsoft Excel.

Find Site Owners for All site collections using PowerShell:

Get-SPSite -Limit 'All' | select URL, Owner, SecondaryContact

For SharePoint 2007 Sites, The PowerShell script to get site Owners for all Site collections would be:

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

$WebAppUrl = "https://sharepoint.crescent.com" #Read-Host "Enter Web Application URL:"
$rootSite = New-Object Microsoft.SharePoint.SPSite($WebAppUrl)

#Get the Web Application from Site Collection
$WebApp = $rootSite.WebApplication

foreach($site in $WebApp.Sites)
{
    Write-Host "$($Site.Url) - $($Site.Owner) : $($Site.Owner.Email)"
    $site.Dispose()
}

Get All Site Owners in SharePoint 2013/2016:

On SharePoint 2010 and above, we can retrieve owner information with a single line of code:

Add-PSSnapin "Microsoft.SharePoint.Powershell" -ErrorAction SilentlyContinue

Get-SPWebApplication "https://sharepoint.crescent.com" | Get-SPSite | foreach-object { Write-host $_.Url - $_.Owner.Email}


Get Me All Site Collections I Own:
This time, I had to find out all site collections a particular user owns. No worries, PowerShell is so powerful!

Add-PSSnapin "Microsoft.SharePoint.Powershell" -ErrorAction SilentlyContinue

Get-SPSite -Filter {$_.Owner -EQ "Global\Salaudeen"} -limit 100

For SharePoint Site Collection Administrators report, Refer: Site Collection Administrators Report for All SharePoint Sites

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!

2 thoughts on “Get All SharePoint Site Collection Owners (Primary/Secondary Site Collection Administrators)

  • Salaudeen —

    This is my go-to site when I need to find or reinforce SharePoint info I’m not sure of. Thanks for sharing all of your hard work here.

    Quick question: how would I go about getting all of the site owners in the farm using the CSOM in PowerShell? Is that possible?

    Reply
    • You mean for On-Premises? Yes, We can get site owners both for SharePoint on-premises and Online using CSOM! Just install CSOM assemblies for respective version and you can code it. Its also possible with PnP PowerShell.

      Reply

Leave a Reply

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