How To Get Site Collection Administrators Using PnP PowerShell

In this blog, we are going to see how to get the site collection administrators using PnP PowerShell in a simple way.

The commands provided by PnP PowerShell are built using the combination of CSOM and REST API and it enables a very easy way to retrieve and update SharePoint Objects.

The Get-PnPSiteCollectionAdmin command is used to get the site collection administrators from the SharePoint site.

Display Site Collection Administrators 

The below PowerShell command is used to connect SharePoint Online and displays the Site Collection administrators of the given site's URL.
  1. $cred = Get-Credential  
  2. Connect-PnPOnline -Url https://<tenant>.sharepoint.com/sites/dev -Credential $cred  
  3. Get-PnPSiteCollectionAdmin  
Output
 
The below output shows the  display of Site Collection administrators for the SharePoint online site https://snips.sharepoint.com/sites/dev