Live Developer Training: next batch coming soon. Be the first to know.Live training: next batch soonJoin the waitlist →Join →

How to Get SharePoint Online Site Details Using PowerShell

Someone asks you about a SharePoint site: when it was created, how much storage it uses, whether guests can get in, or whether it’s locked. The admin center can answer each question, but it takes several clicks per site, and you can’t paste the result into a ticket or a spreadsheet.

PowerShell gives you all of it in one go. I ran every command below against my own Microsoft 365 tenant in PowerShell 7 with PnP.PowerShell 3.3, so the output you see is real. I’ll show which cmdlet returns which detail, because the answer is split across the site and the admin center.

Quick answer: Connect to the site and run Get-PnPWeb -Includes Created, WebTemplate, LastItemModifiedDate for the title, template and dates. For storage, quota, sharing and lock state, connect to https://contoso-admin.sharepoint.com and run Get-PnPTenantSite -Identity <site URL> -Detailed. Pipe either one to Select-Object and Export-Csv for a report.

Which cmdlet returns which site detail

SharePoint keeps site information in two places. The site itself knows its title, description, template and creation date. The tenant admin site knows the storage numbers, quota, sharing setting and lock state. If PnP PowerShell isn’t installed yet, start with my guide on installing PnP PowerShell for SharePoint Online.

Detail you wantCmdletConnect to
Title, URL, description, language, web IDGet-PnPWebThe site
Created date, last item modified date, web templateGet-PnPWeb -Includes …The site
Site collection ID, group ID, storage in bytesGet-PnPSite -Includes Usage, Id, GroupIdThe site
Site collection administratorsGet-PnPSiteCollectionAdminThe site
Storage used and quota (MB), sharing, lock state, last content changeGet-PnPTenantSite -Identity … -DetailedThe admin center

You need your own Entra ID app registration for -ClientId, because the shared PnP Management Shell app stopped working on September 9, 2024. Reading the site needs at least read access to it. The admin center cmdlets need the SharePoint Administrator or Global Administrator role.

Get basic site details with Get-PnPWeb

Get-PnPWeb returns the current site, but only a handful of properties are loaded by default. Properties such as Created and WebTemplate come back empty unless you name them in -Includes:

$siteUrl  = "https://contoso.sharepoint.com/sites/Marketing"
$clientId = "00000000-0000-0000-0000-000000000000"   # your Entra ID app's client ID
Connect-PnPOnline -Url $siteUrl -ClientId $clientId -Interactive

Get-PnPWeb -Includes Created, LastItemModifiedDate, WebTemplate, Language, Description |
    Select-Object Title, Url, Description, WebTemplate, Language, Created, LastItemModifiedDate, Id |
    Format-List

Here’s the run against my test site, followed by a few site collection numbers I’ll explain in the next section:

Get-PnPWeb with -Includes showing SharePoint Online site title, template, created date and ID in PowerShell 7

A few values need translating. WebTemplate shows GROUP for a team site connected to a Microsoft 365 group, SITEPAGEPUBLISHING for a communication site and STS for a team site without a group. My post on team sites vs communication sites explains how those two site types differ. Language is a locale ID, and 1033 means English (United States).

The Id here is the web ID, not the site collection ID. If an ID is all you need, for a Graph call or a Power Automate action, my guide to getting a SharePoint Online site ID covers the other ways to find it.

Get site collection details with Get-PnPSite

Get-PnPSite works one level up, on the site collection. With -Includes Usage you get the storage used without connecting to the admin center, which helps when you’re a site owner but not a SharePoint admin:

$site = Get-PnPSite -Includes Usage, Id, GroupId
"Site collection ID : $($site.Id)"
"Storage used (MB)  : $([math]::Round($site.Usage.Storage / 1MB, 2))"
"Site admins        : $(@(Get-PnPSiteCollectionAdmin).Count)"
"Subsites           : $(@(Get-PnPSubWeb -Recurse).Count)"
"Visible lists      : $(@(Get-PnPList | Where-Object Hidden -eq $false).Count)"

Two things surprised me in my tenant. First, Usage.Storage is in bytes, so my site reported 1,848,971, which is 1.76 MB after dividing by 1MB.

Second, the Hits and Visits values in the same object came back as 0 even though the site is in use, so I don’t use them; the admin center’s usage reports are the place for traffic.

The site admin line only counts the accounts. Get-PnPSiteCollectionAdmin returns each admin’s display name, email and login name, so be careful where you paste that output. If you’re sorting out who should own a site, my SharePoint site owner tutorial explains how owners differ from site collection admins.

# Connected to the site itself, not the admin center
Get-PnPSiteCollectionAdmin | Select-Object Title, Email, LoginName

Get storage, quota, sharing and lock state with Get-PnPTenantSite

The details an admin usually asks for live in the tenant admin site, so this time connect to the admin center URL (your tenant name followed by -admin) and look the site up by URL:

$clientId = "00000000-0000-0000-0000-000000000000"
Connect-PnPOnline -Url "https://contoso-admin.sharepoint.com" -ClientId $clientId -Interactive

Get-PnPTenantSite -Identity "https://contoso.sharepoint.com/sites/Marketing" -Detailed |
    Select-Object Title, Url, Template, StorageUsageCurrent, StorageQuota, StorageQuotaWarningLevel,
        SharingCapability, LockState, LastContentModifiedDate, WebsCount, IsTeamsConnected, Status |
    Format-List

Add -Detailed when you query one site. The PnP documentation warns that without it, some attributes come back with default values that may not be accurate, and the call only takes a few seconds longer. This is my test site:

Get-PnPTenantSite -Identity -Detailed showing SharePoint site storage, quota, sharing capability and lock state

Here’s what the important properties mean, based on what my tenant returned:

PropertyWhat it tells you
TemplateFull template code, e.g. GROUP#0 (group team site), SITEPAGEPUBLISHING#0 (communication site), STS#3 (team site without a group)
StorageUsageCurrentStorage used in MB, rounded, so a tiny site shows 1
StorageQuota / StorageQuotaWarningLevelQuota and warning level in MB. 26214400 MB is 25 TB, the maximum site size, which is what sites show when the tenant uses automatic (pooled) storage
SharingCapabilityExternal sharing for the site: Disabled, ExistingExternalUserSharingOnly, ExternalUserSharingOnly or ExternalUserAndGuestSharing
LockStateUnlock for a normal site; ReadOnly or NoAccess when an admin has locked it
LastContentModifiedDateLast time content changed anywhere in the site collection
WebsCountNumber of webs including the root site, so 1 means no subsites
IsTeamsConnected / StatusWhether a Microsoft Teams team uses the site, and Active for a normal site

If the quota numbers look odd, check how your tenant manages storage. My guide to managing site storage limits in SharePoint shows the switch between automatic and manual limits and where to set a per-site quota.

Build a site details report for several sites

Once you know which properties you need, a loop turns them into a report. I use [pscustomobject] so the column names are short and readable in Excel, and the try/catch keeps one mistyped URL from stopping the whole run:

$urls = "https://contoso.sharepoint.com/sites/Marketing",
        "https://contoso.sharepoint.com/sites/Sales"

$report = foreach ($url in $urls) {
    try {
        $s = Get-PnPTenantSite -Identity $url -Detailed -ErrorAction Stop
        [pscustomobject]@{
            Title        = $s.Title
            Url          = $s.Url
            Template     = $s.Template
            StorageMB    = $s.StorageUsageCurrent
            Sharing      = $s.SharingCapability
            LockState    = $s.LockState
            LastModified = $s.LastContentModifiedDate.ToString('MM/dd/yyyy')
        }
    }
    catch {
        Write-Warning "Skipped $($url): $($_.Exception.Message)"
    }
}
$report | Format-Table -AutoSize
$report | Export-Csv -Path ".\SiteDetails-2026-10-13.csv" -NoTypeInformation

This is the same script against two demo sites in my tenant. Notice that the communication site has external sharing turned off, which is exactly the kind of difference this report is meant to catch:

PowerShell report of SharePoint site details for two sites exported to a CSV file with Export-Csv

For every site in the tenant, skip the URL list and let Get-PnPTenantSite return them all. My post on PnP PowerShell scripts for SharePoint developers has more patterns for reports like this one:

Get-PnPTenantSite |
    Where-Object Template -notlike 'RedirectSite*' |
    Select-Object Title, Url, Template, StorageUsageCurrent, LastContentModifiedDate |
    Sort-Object StorageUsageCurrent -Descending |
    Export-Csv -Path ".\AllSites-2026-10-13.csv" -NoTypeInformation

Without -Identity, the cmdlet returns some properties with default values, so run the per-site -Detailed loop for any column you plan to act on, such as sharing. When a single site is the problem, you can drill into document library size with PnP PowerShell to see where its storage goes.

Common errors and how to fix them

  • “We do not support automatically switching context to the tenant administration site”: you connected to a site with device login and then ran Get-PnPTenantSite. Connect to the admin center URL directly; a site connection made with device login isn’t reused for it.
  • Access denied or 403 Forbidden: your account lacks the SharePoint Administrator role, or an app-only connection lacks tenant-wide SharePoint permissions. The cause is the same as the Connect-SPOService 403 Forbidden error.
  • Created or WebTemplate is empty: the property wasn’t loaded. Add it to -Includes on Get-PnPWeb.
  • SharingCapability or StorageQuota looks wrong: the value came from a list query without -Detailed. Query the single site with -Identity and -Detailed.
  • The site isn’t found: deleted sites in the recycle bin don’t come back from these cmdlets, and a renamed site leaves a redirect site at the old URL with the RedirectSite#0 template.

If the error mentions Register-PnPManagementShellAccess, the script was written for the retired shared app; my post on the Register-PnPManagementShellAccess error walks through the fix.

Get site details with Get-SPOSite instead

The SharePoint Online Management Shell has its own cmdlet. With -Identity, Get-SPOSite returns the full property set for that site, and Microsoft marks its -Detailed switch as deprecated. Two catches: you need to be a SharePoint admin, and without -Limit All a list query stops at 200 sites:

Connect-SPOService -Url https://contoso-admin.sharepoint.com

# One site: -Identity returns the full property set
Get-SPOSite -Identity https://contoso.sharepoint.com/sites/Marketing |
    Select-Object Title, Url, Template, StorageUsageCurrent, StorageQuota, SharingCapability, LockState

# All sites: without -Limit All you only get 200
Get-SPOSite -Limit All | Select-Object Title, Url, StorageUsageCurrent

Microsoft also notes that when you use -Limit or -Filter, properties such as SharingCapability and SensitivityLabel aren’t populated. I still prefer PnP for this job because the same session can move on to lists, files and permissions without a second module.

When you’re done with the site details, these PnP PowerShell guides help with the next task:

Frequently Asked Questions

How do I get SharePoint Online site details using PowerShell?

Connect to the site with Connect-PnPOnline and run Get-PnPWeb -Includes Created, WebTemplate, LastItemModifiedDate for the basics. For storage, quota, sharing and lock state, connect to the admin center and run Get-PnPTenantSite -Identity -Detailed.

How do I find when a SharePoint site was created?

Run Get-PnPWeb -Includes Created and read the Created property. In the SharePoint Online Management Shell, Get-SPOSite -Identity returns the same information for the site collection.

What unit is StorageUsageCurrent in?

StorageUsageCurrent and StorageQuota are in megabytes. Usage.Storage from Get-PnPSite -Includes Usage is in bytes, so divide it by 1MB in PowerShell to compare the two.

Why do I need -Detailed with Get-PnPTenantSite?

Without it, some attributes are returned with default values that may not be accurate. -Detailed populates every attribute at the cost of a slower call. The Get-PnPTenantSite reference lists the parameters.

Can I get site details without being a SharePoint admin?

Yes, partly. With access to the site you can run Get-PnPWeb and Get-PnPSite -Includes Usage. Tenant-level details from Get-PnPTenantSite or Get-SPOSite need the SharePoint Administrator role.