Tuesday, February 18, 2014

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

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:
stsadm -0 enumsites -url <web-app-url>
stsadm -0 enumsites -url "http://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:

$WebAppUrl = "http://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)"

Get All Site Owners in SharePoint 2010/2013:
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 "http://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

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...