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.
- $cred = Get-Credential
- Connect-PnPOnline -Url https:
- Get-PnPSiteCollectionAdmin
Output
The below output shows the display of Site Collection administrators for the SharePoint online site
https://snips.sharepoint.com/sites/dev