Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

Get-SPOSite: Get SharePoint Online Site Details with PowerShell

To get SharePoint Online site details using PowerShell, connect with Connect-SPOService and run Get-SPOSite -Identity <site URL>. It returns the title, template, storage, sharing level, lock state and more for that site in one call.

In this tutorial, I’ll show you how I use Get-SPOSite to read one site, list every site with -Limit All, narrow the list with -Filter and -Template, export a CSV report, and get the same details with PnP PowerShell.

Here’s the shortest version that works:

Connect-SPOService -Url "https://<tenant>-admin.sharepoint.com"
Get-SPOSite -Identity "https://<tenant>.sharepoint.com/sites/SPGuides"

Without Format-List, it prints a short table with the URL, owner and storage quota of the site.

Get-SPOSite Syntax and Parameters

Get-SPOSite comes with the SharePoint Online Management Shell, so install that module first. Our SharePoint Online Management Shell tutorial covers the setup, and I ran every SPO example here in Windows PowerShell 5.1.

The cmdlet has separate parameter sets, so -Identity can’t be mixed with -Filter or -Template:

Get-SPOSite [[-Identity] <SpoSitePipeBind>] [-Limit <String>] [-Detailed]

Get-SPOSite [-Filter <String>] [-Limit <String>] [-Template <String>]
    [-IncludePersonalSite <Boolean>] [-GroupIdDefined <Boolean>]
ParameterWhat it does
-IdentityReturns one site by URL, with the full property set
-LimitHow many sites to return. Default 200, All for every site
-FilterServer-side filter on Url, Owner, Template, LockState or IsAuthoritative
-TemplateOnly sites built from one template, such as SITEPAGEPUBLISHING#0
-IncludePersonalSite$true adds OneDrive sites (off by default)
-DetailedDeprecated. -Identity already returns the full property set

You need the SharePoint Administrator role, and the cmdlet expects you to be a site collection administrator of the sites you read. Sites in the recycle bin don’t show up, but redirect sites left behind by a rename do.

Basic Example: Get One SharePoint Site with Get-SPOSite -Identity

This is the quickest way to get an SPO site’s details. The connection goes to the admin center URL, not the site, as our connect to SharePoint Online with PowerShell post explains.

If this is your first PowerShell script, here’s how I run it:

  1. Open Windows PowerShell 5.1 from the Start menu.
  2. Save the script below as Get-SiteDetails.ps1 in a folder, or paste it into the console window.
  3. Run .\Get-SiteDetails.ps1 and sign in with your SharePoint admin account if asked.

I picked the properties people ask me about most and ran them against our SPGuides team site. Here’s the script I used in the console:

$AdminUrl = "https://<tenant>-admin.sharepoint.com"
Connect-SPOService -Url $AdminUrl

# Get the details of one SharePoint site
Get-SPOSite -Identity "https://<tenant>.sharepoint.com/sites/SPGuides" |
    Format-List Url, Title, Template, SiteId, StorageUsageCurrent, StorageQuota,
        SharingCapability, LockState, LastContentModifiedDate, WebsCount,
        IsTeamsConnected, Status
Url                     : https://<tenant>.sharepoint.com/sites/SPGuides
Title                   : SPGuides
Template                : GROUP#0
SiteId                  : 06b95e91-2e80-4e04-abb6-45372e7209f4
StorageUsageCurrent     : 123
StorageQuota            : 26214400
SharingCapability       : ExternalUserSharingOnly
LockState               : Unlock
LastContentModifiedDate : 11/27/2026 8:36:44 AM
WebsCount               : 3
IsTeamsConnected        : True
Status                  : Active
Get-SPOSite -Identity output showing the details of one SharePoint Online site in Windows PowerShell

StorageUsageCurrent and StorageQuota are in MB. The 26214400 MB quota is 25 TB, which is what every site shows when the tenant uses pooled storage.

WebsCount counts the root site too, so 3 means two subsites. If you need the SharePoint site ID in PowerShell, the SiteId line has it, and our get SharePoint Online site ID post shows other ways.

I also tried the old -Detailed switch with -Identity. Module 16.0.27424 still runs it without a warning, but it adds nothing, so I leave it out.

Get-SPOSite -Limit All: List All Sites in SharePoint Online

Without -Identity, the cmdlet lists sites, but it stops at 200. Here’s what I got when I ran this in the console, next to -Limit All and the OneDrive count:

$AdminUrl = "https://<tenant>-admin.sharepoint.com"
Connect-SPOService -Url $AdminUrl

# Default: only the first 200 sites
"Default         : " + @(Get-SPOSite).Count

# Every site collection in the tenant
"Limit All       : " + @(Get-SPOSite -Limit All).Count

# Every site plus OneDrive (personal) sites
"With OneDrive   : " + @(Get-SPOSite -Limit All -IncludePersonalSite $true).Count
WARNING: More results were found but were not returned.  Use '-Limit ALL' to return all possible results.
Default         : 200
Limit All       : 206
With OneDrive   : 221
Get-SPOSite returning 200 sites by default and 206 with -Limit All in SharePoint Online

The warning is the clue: 200 is a cap, not the real total. With -Limit All, I got all 206 site collections, and -IncludePersonalSite $true added 15 OneDrive sites.

So for any PowerShell list of sites, always add -Limit All. If your scripts already use PnP, our get all SharePoint Online sites with PnP PowerShell tutorial does the same with Get-PnPTenantSite.

How Do You Use the Get-SPOSite Filter?

-Filter runs on the server, so SharePoint sends back only the matching sites. The value is a string in the form "Property -operator 'value'". Paste this into the console:

$AdminUrl = "https://<tenant>-admin.sharepoint.com"
Connect-SPOService -Url $AdminUrl

# Server-side filter: sites whose URL contains SPGDemoComm
Get-SPOSite -Filter "Url -like 'SPGDemoComm'" |
    Select-Object @{ n = "Site"; e = { $_.Url -replace "^https://[^/]+", "" } },
        Title, Template, LockState |
    Format-Table -AutoSize
Site                       Title                 Template             LockState
----                       -----                 --------             ---------
/sites/SPGDemoCommSPO      SPGDemo Comm SPO      SITEPAGEPUBLISHING#0 Unlock
/sites/SPGDemoCommProjects SPGDemo Comm Projects SITEPAGEPUBLISHING#0 Unlock
/sites/SPGDemoCommPS       SPGDemo Comm PS       SITEPAGEPUBLISHING#0 Unlock
/sites/SPGDemoCommShowcase SPGDemo Comm Showcase SITEPAGEPUBLISHING#0 Unlock
Get-SPOSite -Filter on the Url property returning four SharePoint communication sites

The -like filter matched part of the URL, so I didn’t need wildcards. It returned all four of our SPGDemo communication sites.

Filters work on Url, Owner, Template, LockState and IsAuthoritative, with -eq, -ne, -like and -notlike. Two more patterns I use:

# Sites owned by one person
Get-SPOSite -Filter "Owner -eq 'rachel.morgan@<tenant>.onmicrosoft.com'"

# Locked sites only
Get-SPOSite -Filter "LockState -eq 'ReadOnly'" -Limit All

The Owner filter only matches the primary admin. Our get the SharePoint site owner using PowerShell post covers group-connected sites, where the owner is the Microsoft 365 group.

Keep the operators lowercase, and don’t join conditions with -or. Both fail, as you’ll see in the errors section below.

Get SharePoint Sites by Template with Get-SPOSite -Template

Templates tell you what kind of site you’re looking at. GROUP#0 is a Microsoft 365 group team site, SITEPAGEPUBLISHING#0 is a communication site, and STS#3 is a team site without a group.

I grouped every site in our tenant by template, then used -Template to count communication sites. I ran it in the console:

$AdminUrl = "https://<tenant>-admin.sharepoint.com"
Connect-SPOService -Url $AdminUrl

# How many sites use each template?
Get-SPOSite -Limit All |
    Group-Object Template |
    Sort-Object Count -Descending |
    Select-Object Count, Name -First 6 |
    Format-Table -AutoSize

# Communication sites only
"Communication sites: " + @(Get-SPOSite -Template "SITEPAGEPUBLISHING#0" -Limit All).Count
Count Name
----- ----
  127 GROUP#0
   42 SITEPAGEPUBLISHING#0
   20 RedirectSite#0
    6 STS#3
    3 RedirectSite#1
    1 APPCATALOG#0

Communication sites: 42
Get-SPOSite grouped by template and filtered with -Template SITEPAGEPUBLISHING#0

Both methods agree on 42 communication sites. The 23 RedirectSite entries are old URLs left behind after site renames, so exclude them from reports.

For one site’s template, see our get site template in SharePoint using PowerShell post. If you’re unsure which type to build, read SharePoint communication site vs team site.

Export SharePoint Site Details to CSV

One catch matters for reports. With -Limit or -Filter, Microsoft doesn’t promise that properties like SharingCapability, DenyAddAndCustomizePages or SensitivityLabel are filled in correctly.

In my test, the sharing values matched, but I don’t rely on that. My report gets the list with -Filter, then reads each site again with -Identity. Save it as Export-SiteReport.ps1 and run it in VS Code:

$AdminUrl = "https://<tenant>-admin.sharepoint.com"
Connect-SPOService -Url $AdminUrl

# Build a report of the SPGDemo sites and save it as CSV
$report = Get-SPOSite -Filter "Url -like 'SPGDemoComm'" | ForEach-Object {
    $s = Get-SPOSite -Identity $_.Url     # full property set per site
    [pscustomobject]@{
        Title     = $s.Title
        Url       = $s.Url
        Template  = $s.Template
        StorageMB = $s.StorageUsageCurrent
        Sharing   = $s.SharingCapability
        Modified  = $s.LastContentModifiedDate.ToString("MM/dd/yyyy")
    }
}
$report | Export-Csv -Path ".\SPGuides-Sites-2026-11-27.csv" -NoTypeInformation

Import-Csv ".\SPGuides-Sites-2026-11-27.csv" |
    Format-Table Title, Template, StorageMB, Sharing, Modified -AutoSize
Title                 Template             StorageMB Sharing  Modified
-----                 --------             --------- -------  --------
SPGDemo Comm SPO      SITEPAGEPUBLISHING#0 1         Disabled 11/27/2026
SPGDemo Comm Projects SITEPAGEPUBLISHING#0 1         Disabled 11/27/2026
SPGDemo Comm PS       SITEPAGEPUBLISHING#0 1         Disabled 11/27/2026
SPGDemo Comm Showcase SITEPAGEPUBLISHING#0 1         Disabled 11/27/2026
VS Code running a Get-SPOSite script that exports SharePoint site details to a CSV file

The CSV file showed up in the VS Code Explorer, and Import-Csv read it back with all four sites. Open it in Excel, or share it from OneDrive.

If the storage columns look odd, check how your tenant handles quotas. Our SharePoint site storage limits post explains pooled vs manual storage.

Get-PnPTenantSite: The PnP Equivalent of Get-SPOSite

PnP PowerShell has Get-PnPTenantSite for the same job, and I run it in PowerShell 7 with PnP.PowerShell 3.3.0. Since September 2024, PnP needs your own Entra ID app registration, and -Interactive opens a sign-in window. Our install PnP PowerShell guide covers both.

Like Get-SPOSite, it connects to the admin center. I added -Detailed because PnP returns some default values without it. I ran it as Get-PnPSiteDetails.ps1 from VS Code:

$ClientID = "<your-entra-app-client-id>"
$AdminUrl = "https://<tenant>-admin.sharepoint.com"
Connect-PnPOnline -Url $AdminUrl -ClientId $ClientID -Interactive

# PnP equivalent of Get-SPOSite -Identity
Get-PnPTenantSite -Identity "https://<tenant>.sharepoint.com/sites/SPGuides" -Detailed |
    Format-List Title, Template, StorageUsageCurrent, StorageQuota,
        SharingCapability, LockState, WebsCount

# PnP equivalent of Get-SPOSite -Filter
Get-PnPTenantSite -Filter "Url -like 'SPGDemoComm'" |
    Select-Object Title, Template | Format-Table -AutoSize
Title               : SPGuides
Template            : GROUP#0
StorageUsageCurrent : 123
StorageQuota        : 26214400
SharingCapability   : ExternalUserSharingOnly
LockState           : Unlock
WebsCount           : 3

Title                 Template
-----                 --------
SPGDemo Comm Projects SITEPAGEPUBLISHING#0
SPGDemo Comm PS       SITEPAGEPUBLISHING#0
SPGDemo Comm Showcase SITEPAGEPUBLISHING#0
SPGDemo Comm SPO      SITEPAGEPUBLISHING#0
Get-PnPTenantSite -Detailed and -Filter output in VS Code with PowerShell 7

The values match the Get-SPOSite run exactly, and -Filter uses the same syntax. That makes moving a script from one module to the other easy.

Get-PnPSite and Get-PnPWeb: Site Details Without Admin Rights

Get-PnPSite and Get-PnPWeb read the site you’re connected to, so a site owner can run them without the SharePoint Administrator role. They also return things Get-SPOSite doesn’t, like the created date. Save this as Get-PnPWebDetails.ps1 and run it in VS Code:

$ClientID = "<your-entra-app-client-id>"
$SiteUrl  = "https://<tenant>.sharepoint.com/sites/SPGuides"
Connect-PnPOnline -Url $SiteUrl -ClientId $ClientID -Interactive

# Site collection: ID and storage used (bytes)
$site = Get-PnPSite -Includes Id, Usage
"Site ID      : $($site.Id)"
"Storage (MB) : $([math]::Round($site.Usage.Storage / 1MB, 1))"

# Root web: created date, template and language
Get-PnPWeb -Includes Created, WebTemplate, Language |
    Format-List Title, WebTemplate, Language, Created
Site ID      : 06b95e91-2e80-4e04-abb6-45372e7209f4
Storage (MB) : 123.4

Title       : SPGuides
WebTemplate : GROUP
Language    : 1033
Created     : 12/29/2020 9:15:33 AM
Get-PnPSite and Get-PnPWeb showing the SharePoint site ID, storage and created date

The site ID matches the SiteId from Get-SPOSite. Usage.Storage is in bytes, so I divided by 1MB, and WebTemplate shows GROUP without the #0.

Properties such as Created come back empty unless you name them in -Includes.

Get-SPOSite or Get-PnPTenantSite: Which One Should You Use?

NeedSPO Management ShellPnP PowerShell
One site’s detailsGet-SPOSite -IdentityGet-PnPTenantSite -Identity -Detailed
All sites / filter-Limit All, -FilterGet-PnPTenantSite, -Filter
Created date, listsNot availableGet-PnPWeb, Get-PnPList
PowerShell versionWindows PowerShell 5.1PowerShell 7
SetupAdmin sign-in onlyYour own Entra ID app

For a quick admin check, I use Get-SPOSite. When the script goes on to lists, files or Microsoft Teams sites, I keep it all in PnP.

Two related SPO cmdlets come up often. Get-SPOTenant returns tenant-wide settings instead of one site’s, and Get-SPOHomeSite returns the home site URL. In our tenant, it only printed a warning because no home site is set.

Get-SPOSite Errors and Fixes

These are the three SharePoint errors I reproduced on purpose. To see them yourself, save this as Test-GetSPOSiteErrors.ps1 and run it in a new console:

# 1. Running Get-SPOSite before Connect-SPOService
try { Get-SPOSite -Identity "https://<tenant>.sharepoint.com/sites/SPGuides" -ErrorAction Stop }
catch { "Failed: $($_.Exception.Message)" }

Connect-SPOService -Url "https://<tenant>-admin.sharepoint.com"

# 2. A site that doesn't exist (or sits in the recycle bin)
try { Get-SPOSite -Identity "https://<tenant>.sharepoint.com/sites/SPGDemoMissing" -ErrorAction Stop }
catch { "Failed: $($_.Exception.Message)" }

# 3. An operator with the wrong case in -Filter
try { Get-SPOSite -Filter "Url -Like 'SPGDemo'" -ErrorAction Stop }
catch { "Failed: $($_.Exception.Message)" }
Failed: No connection available. Use Connect-SPOService before running this CmdLet.
Failed: Cannot get site https://<tenant>.sharepoint.com/sites/SPGDemoMissing.
Failed: Syntax error in the filter expression 'Url -Like 'SPGDemo''.
Get-SPOSite errors for no connection, a missing site and a filter syntax error

The first one means there’s no session yet, so run Connect-SPOService first. The second one means the URL is wrong or the site is in the recycle bin, so check the deleted sites in the SharePoint admin center.

The third one comes from -Like with a capital L. Filter operators are case-sensitive, and -or gives the same syntax error.

  • Get-SPOSite is not recognized: the module isn’t loaded. Our Connect-SPOService not recognized post has the fix.
  • Current site is not a tenant administration site: you connected to a site URL. See this fix.

I’d keep these SharePoint PowerShell posts handy next:

Questions About Get-SPOSite

What is Get-SPOSite used for?

It returns the properties of SharePoint Online site collections, such as title, template, storage, sharing and lock state. Use -Identity for one site or -Limit All for every site.

Why does Get-SPOSite return only 200 sites?

200 is the default -Limit. Add -Limit All to return every site collection, and -IncludePersonalSite $true to add OneDrive sites.

What is the difference between Get-SPSite and Get-SPOSite?

Get-SPSite is a SharePoint Server (on-premises) cmdlet that runs on the farm. Get-SPOSite is the SharePoint Online cmdlet from the SPO Management Shell.

Is the Get-SPOSite -Detailed parameter still needed?

No. It’s deprecated, and -Identity already returns the full property set. In PnP, Get-PnPTenantSite -Detailed is still useful.

Where can I find every Get-SPOSite parameter?

The full list, including -ArchiveStatus and -GroupIdDefined, is in the Get-SPOSite cmdlet reference.