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 to broadcast a message, such as news, reports, etc., to your organization in a visually compelling way. E.g., Intranet site. Finding all communication sites in a SharePoint Online tenant can be a daunting task, especially if the tenant has a large number of sites. In this guide, we will go through the steps of finding all communication sites in a SharePoint Online tenant using Sharepoint Admin center and PowerShell.
To get a list of communication sites in SharePoint Online through SharePoint Admin Center, do the following:
- Login to the SharePoint admin center (At https://tenant-admin.sharepoint.com).
- 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: PowerShell to Get All Communication Sites
Communication sites in SharePoint Online tenants can be quickly listed by filtering sites based on the web template ID “SITEPAGEPUBLISHING#0”.
#Parameters
$TenantAdminURL = "https://crescent-admin.sharepoint.com"
#Connect to Tenant Admin Site
Connect-SPOService -url $TenantAdminURL -Credential (Get-Credential)
#Get All Communication Sites
Get-SPOSite -Template SITEPAGEPUBLISHING#0 -Limit ALL
This script lists every modern communication site in the tenant.
Let’s add a site collection administrator to all communication sites in the tenant.
#Parameters
$TenantAdminURL = "https://crescent-admin.sharepoint.com"
$AdminID = "Salaudeen@crescent.com"
#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:
#Parameters
$TenantAdminURL = "https://crescent-admin.sharepoint.com"
#Connect to Tenant Admin Site
Connect-PnPOnline -url $TenantAdminURL -Interactive
#Get All Communication Sites
Get-PnPTenantSite -Template "SITEPAGEPUBLISHING#0"
Conclusion:
In conclusion, finding all communication sites in SharePoint Online can be done using SharePoint Admin center or PowerShell. By connecting to SharePoint Online using PowerShell, you can use the cmdlets to retrieve a list of all sites in the tenant and filter the results to only show communication sites based on their template. It’s important to note that you must have SharePoint Admin permissions to access SharePoint Online and perform the actions you want to perform. By following this guide, you can easily find all communication sites in a SharePoint Online tenant and use the information to manage, analyze, and report on your sites.