SharePoint Online: Find All Communication Sites using PowerShell

Requirement: Get All Communication Sites in SharePoint Online Tenant

How to Find All Communication Site Collections in SharePoint Online?
Communication sites are used broadcast a message such as news, reports, etc. to your organization in a visually compelling way. E.g. Intranet site. If you want to get a list of communication sites in SharePoint Online,
  • Login to SharePoint admin center (At
  • Click on Sites >> Active Sites. This gets you all sites in the tenant. Now you can filter sites based on a specific site template, E.g. "Communication Sites". 
    sharepoint online get all communication site collections

SharePoint Online: PowerShell to Get All Communication Sites
Communication sites in SharePoint Online tenant can be quickly listed by filtering sites based on the web template ID "SITEPAGEPUBLISHING#0".
$TenantAdminURL = ""

#Connect to Tenant Admin Site
Connect-SPOService -url $TenantAdminURL -Credential (Get-Credential)

#Get All Communication Sites
This script lists every modern communication site in the tenant.
powershell to find all communication sites in sharepoint online
Let's add a site collection administrator to all communication sites in the tenant.
$TenantAdminURL = ""
$AdminID = "[email protected]"

#Connect to Admin Center
Connect-SPOService -Url $TenantAdminURL -Credential (Get-credential)

#Get All Communication Sites
Get-SPOSite -Template SITEPAGEPUBLISHING#0 | ForEach-Object {
    #Add Site Collection Admin
    Set-SPOUser -Site $_.Url -LoginName $AdminID -IsSiteCollectionAdmin $True | Out-Null
    Write-host -f Green "Added Site collection Administrator to site:"$_.URL

PnP PowerShell to Find All Communication Site collections
Similar to the above SharePoint Online Management Shell, The PnP cmdlets also can be used to list all Communication sites:
$TenantAdminURL = ""

#Connect to Tenant Admin Site
Connect-PnPOnline -url $TenantAdminURL -UseWebLogin

#Get All Communication Sites
Get-PnPTenantSite -Template "SITEPAGEPUBLISHING#0"

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.