PowerShell Genie

SharePoint site inventory

Script 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Inventory SharePoint Online site collections with Get-SPOSite -Limit All and inspect the returned site properties.

The script

1PS> Get-SPOSite -Limit All | Select-Object Url,Owner,StorageQuota,StorageUsageCurrent,Status

Script reader

Inspect before you run

Inspection only

Inspect the script below. It does not run in this browser.

Inspection only — no command has run.

    Show reference output
    1 Url Owner StorageQuota StorageUsageCurrent Status
    2 --- ----- ------------ ------------------- ------
    3 https://example.test/sites/demo admin@example.test 26214400 1280 Running
    Inspect this example’s structure

    Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

    Get-SPOSite -Limit All | Select-Object Url,Owner,StorageQuota,StorageUsageCurrent,Status
    1. Stage 1Get-SPOSite-Limit
    2. Stage 2Select-ObjectPositional values or no named parameters

      How it works

      Inventory SharePoint Online site collections with Get-SPOSite -Limit All and inspect the returned site properties. The projection keeps the URL with the owner, the configured StorageQuota, the current StorageUsageCurrent figure, and the site status.

      Adapting it

      Add -IncludePersonalSite $true to pull OneDrive sites into the report, which is normally where the unexpected consumption turns out to live.

      Requirements

      SharePoint Online module with Connect-SPOService and SharePoint administrator rights.

      If the result is unexpected

      The SharePoint site list is missing sites or contains the wrong tenant.

      The administrative endpoint and query options determine the inventory scope.

      1. Confirm the tenant admin URL and inspect a known site before comparing the list.

      Validate the result

      The result identifies the intended tenant and the site categories included.

      Keep the check reliable

      Document whether personal sites and other special site types are in scope.

      Primary documentation

      PowerShell objects and pipelines documentation

      Continue
      Genie guideSharePoint site inventory

      Inventory SharePoint Online site collections with Get-SPOSite -Limit All and inspect the returned site properties.