In this blog, you will see how to get all site collection administrators from SharePoint Online Site Collections from your tenant using PnP PowerShell.
You can download the setup files from the releases section of the PnP PowerShell repository.
Copy the below script and paste it in a Notepad. Save the file as GetSCA.ps1.
- # Input Parameters
- $credentials=Get-Credential
- $URL="https://c986.sharepoint.com"
- # Connect to SharePoint Online
- Connect-PnPOnline -Url $URL -Credentials $credentials
- # Get the site collections
- $siteColl=Get-PnPTenantSite
- # Loop through the site collections
- foreach($site in $siteColl)
- {
- write-host -ForegroundColor Green "Getting SCA from site: " $site.Url
- Connect-PnPOnline -Url $site.Url -Credentials $credentials
- # Get the site collection administrators
- $scaColl=Get-PnPSiteCollectionAdmin
- foreach($sca in $scaColl)
- {
- $sca
- }
- }
Open PowerShell window and run the following command.
- >cd "<folderlocation>"
folderlocation – GetSCA.ps1 file location
Run the following command
- >.\GetSCA.ps1
Thus, in this blog, you saw how to get all site collection administrators from SharePoint Online Site Collections using PnP PowerShell.

Arunkumar ChandrasekaranPosted Oct 21, 2021, 10:59 AM
I get error on line 18 - Get-PnPSiteCollectionAdmin : Array dimensions exceeded supported range.
Deepak VermaPosted Jul 30, 2018, 5:11 AM
Good one.................
Viknaraj ManogararajahPosted Jul 21, 2018, 9:59 AM
nice article, thank you for sharing
Hadshana KamalanathanPosted Jul 19, 2018, 10:43 AM
Nice one...