Skip to content
Menu
SharePoint Gems
  • Power Platform
  • Development
    • SharePoint 2013
  • Migration
  • Administration
  • SP Online
  • Contact
  • About
    • Privacy Policy
SharePoint Gems

Retrieve all Communication Sites using PnP PowerShell

Posted on June 11, 2020September 29, 2021

Hello SharePointers,
During my latest development, my client asked me to get all Communication Sites using PnP PowerShell.

For Example, Communication Sites, Hub Sites, Classic team site, and Modern team site.

From UI we can just filter the site type and get it done, but listing down all sites is a very time-consuming task.

Contents hide
1 Get all Communication sites from Tenant.
2 PowerShell to get all Communication sites from SharePoint Online
2.1 Psudocode
2.2 Script:
3 PnP PowerShell to find all Communication sites
4 Retrieve All Communication Sites using SPO PowerShell
4.1 Share this:
4.2 Like this:
4.3 Related

Get all Communication sites from Tenant.

To Do this from UI, you can just follow below steps.

  1. Go to the SharePoint admin center by typing URL https://<your tenant>-admin.sharepoint.com
  2. Select Sites -> Active Sites
  3. Go to Template
  4. Select Filter by Template
  5. Select Communication Site
Retrieve all Communication Sites using PnP PowerShell
Retrieve all Communication Sites using PowerShell

In this way, we can get all communication sites from SharePoint Online manually from UI. Now let us see the same results using SPO PowerShell

PowerShell to get all Communication sites from SharePoint Online

Now we are going write a PowerShell script to retrieve all communication sites from PowerShell.

Psudocode

Step 1. Connect to SharePoint Admin Site
Step 2. Get All communication site.

Script:

And here is a script to retrieve all Communication sites from SharePoint Online tenant.

PnP PowerShell to find all Communication sites

Below are the PnP commandlets used to find all communication sites from tenant.

$AdminSite = "https://sharePointgems-admin.sharepoint.com"
 
#Connect SharePoint Admin Site
Connect-PnPOnline -url $AdminSite -UseWebLogin
 
#Retrieve All Communication Sites
Get-PnPTenantSite -Template SITEPAGEPUBLISHING#0

Retrieve All Communication Sites using SPO PowerShell

In a similar way as PnP PowerShell, we can fin all communication sites using SharePoint Management Shell as well. Below is the code for the same.

$AdminSite = "https://sharePointgems-admin.sharepoint.com"
 
#Connect SharePoint Admin Site
Connect-SPOService -url $AdminSite -Credential (Get-Credential)
 
#Retrieve All Communication Sites
Get-SPOSite -Template SITEPAGEPUBLISHING#0 -Limit ALL

This script results will list down all communication sites based on template type called “SITEPAGEPUBLISHING#0”.


how to get all subsites in sharepoint using powershell, pnp powershell get site owners, get site template sharepoint online powershell get all site collection administrators powershell get-pnptenantsite 403 forbidden
pnp community get-pnpweb example pnp powershell get site owners
pnp sites get-pnptenantsite : value cannot be null. new-pnpsite pnp powershell.

Share this:

  • Print
  • Twitter
  • Facebook
  • LinkedIn
  • WhatsApp
  • Telegram
  • Pinterest
  • Reddit

Like this:

Like Loading...

Related

7 thoughts on “Retrieve all Communication Sites using PnP PowerShell”

  1. ปั้มไลค์ says:
    July 16, 2020 at 12:10 PM

    Like!! Thank you for publishing this awesome article.

    Loading...
    Reply
  2. ทิชชู่เปียกแอลกอฮอล์ says:
    July 16, 2020 at 12:11 PM

    I like the valuable information you provide in your articles.

    Loading...
    Reply
  3. SMS says:
    July 16, 2020 at 12:16 PM

    bookmarked!!, I like your blog!

    Loading...
    Reply
  4. Pingback: Get Current Context from SharePoint Modern Site Page - SharePoint Gems
  5. Pingback: Retrieve all users from Site Collection using PowerShell - SharePoint Gems
  6. Pingback: Delete all items from SharePoint list with CSOM - SharePoint Gems
  7. Pingback: PnP PowerShell to get all Site Collections - SharePoint Gems

Leave a ReplyCancel reply

  • Development
  • Migration
  • Poweer Apps
  • Power Automate
  • Power Platform
  • SharePoint 2013
  • SharePoint Administration
  • SharePoint Online
  • Tips
  • Uncategorized

Best of Computers

Blog Stats

  • 67,509 hits

Subscribe

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,433 other subscribers
Buy Me Coffee
©2025 SharePoint Gems | Powered by WordPress and Superb Themes!
%d