Build a SharePoint site inventory: admin center and PowerShell

Published: Updated: 6 min readPowerShell, SharePoint Online
SharePoint site inventory: the admin center Largest sites view and the Get-MttSite PowerShell output

Every governance review, Copilot readiness check or migration plan I work on starts with the same request: send me a list of every SharePoint site. The admin center gives you most of it in a few clicks. PowerShell gives you the rest, and lets you repeat it every month.

Key takeaways

  • The SharePoint admin center Active sites page exports every site to CSV, but hubs show as GUIDs, templates as IDs, and Teams channel sites are left out.
  • Get-MttSite lists every site in one call (2 seconds for 68 sites) with a readable site type, storage, hub name, Teams connection and lock state.
  • Use the Largest sites and Least active sites views, or the matching PowerShell filters, to find storage hogs and inactive sites, and check each site’s external sharing.

I ran each scenario below on my demo tenant (68 sites, 31.38 GB) on 20 November 2026, first in the SharePoint admin center and then with a new function, Get-MttSite.

On this page

Prerequisites

  • SharePoint Administrator role.
  • SharePoint Online Management Shell. I used version 16.0.27814.12015.
  • Windows PowerShell 5.1, or PowerShell 7 with the module imported using -UseWindowsPowerShell.

1 – Export every site

In the admin center:

  1. Open the SharePoint admin center > Sites > Active sites.
  2. Select Export on the command bar. The CSV holds the view you are looking at.
SharePoint admin center Active sites page with the Export button and the standard views highlighted

Two things to know about that CSV. The hub shows as a GUID and the template as an ID such as STS#0 (Microsoft Learn). And Active sites leaves out Teams channel sites (private and shared channels): they only appear through the Channel sites column of their team. On my tenant those are the three extra sites PowerShell returns.

With PowerShell, the function lists every site in one call. It took 2 seconds for 68 sites.

# Module: SharePoint Online Management Shell (Microsoft.Online.SharePoint.PowerShell)
$AdminURL = "https://mstalk-admin.sharepoint.com"   # Replace with your own

# PowerShell 7 only: Import-Module Microsoft.Online.SharePoint.PowerShell -UseWindowsPowerShell
Connect-SPOService -Url $AdminURL
. .\Get-MttSite.ps1

Get-MttSite | Export-Csv -Path "C:\Temp\Sites.csv" -NoTypeInformation -Encoding UTF8

Each row has the site URL, title, a readable site type, template, primary admin, storage in GB, last change date, Teams connection, hub name and lock state. Unlike the admin center export, the hub is a name, not a GUID.

Get-MttSite PowerShell output listing the MST demo sites with site type, storage, hub and Teams connection

2 – Find the largest sites

In the admin center, open the view menu at the right of the command bar and select Largest sites. It sorts by Storage used (GB).

SharePoint admin center Largest sites view sorted by storage used

The PowerShell version:

Get-MttSite | Sort-Object StorageUsedGB -Descending | Select-Object -First 10 SiteUrl, SiteType, StorageUsedGB

On my tenant one event site holds 23.92 GB of the 31.38 GB, three quarters of the total. The storage post shows how to find what is filling a site like that.

3 – Find inactive sites

In the admin center, select the Least active sites view. The column to read is Last activity (UTC), which is based on user activity such as file views, edits and page visits.

SharePoint admin center Least active sites view showing the Last activity column

With SharePoint Advanced Management you can go further: Policies > Site lifecycle management > Inactive site policies emails site owners and can make a site read-only or archive it when nobody responds (Microsoft Learn).

In PowerShell, Get-MttSite has DaysSinceLastChange:

Get-MttSite | Where-Object { $_.DaysSinceLastChange -gt 180 } | Select-Object SiteUrl, LastContentModified, DaysSinceLastChange

Be careful with this one. It comes from LastContentModifiedDate, which moves with any change on the site, not only changes people make. On my tenant 40 of the 68 sites show exactly the same date, 9 September 2026, and nobody touched 40 sites that day. The site “Distributor Portal” shows a change 7 days ago, while the admin center says its last user activity was 24 July 2022.

So I use the PowerShell date to answer “has anything changed?”, and the admin center’s Last activity (or the inactive site policy) to answer “is anyone using it?”.

4 – Sites by type, and group sites without a team

The admin center has a view for each: Sites connected to Teams, Microsoft 365 group sites, Sites without a group and Classic sites.

In PowerShell, the SiteType column turns template IDs into names, so one line gives the whole breakdown:

Get-MttSite | Group-Object SiteType | Select-Object Name, Count

My tenant: 30 group sites, 17 communication sites, 8 team sites without a group, 8 classic sites, 3 channel sites, the app catalog and the root site.

The question no standard view answers is which group sites have no team. They are often groups created from Outlook or Viva Engage that nobody uses:

Get-MttSite | Where-Object { $_.SiteType -eq 'Group site' -and -not $_.IsTeamsConnected }

That found 11 of my 30 group sites, most of them empty test groups.

5 – Which sites belong to which hub

In the admin center, the Hub column shows the hub of each site, and you can filter on it.

In PowerShell, HubSite holds the hub’s name, and IsHubSite marks the hub sites themselves:

Get-MttSite | Where-Object HubSite | Group-Object HubSite | Select-Object Name, Count

The count includes the hub site itself: MST Intranet shows 7, the hub plus its six associated sites. My tenant also showed something the admin center hides: three of its four hubs (Contoso HR, Global Marketing and Global Sales) no longer have a hub site. Get-SPOHubSite returns them with an empty site URL, yet sites are still associated with them. Look for hub names with no matching IsHubSite row:

Get-SPOHubSite | Where-Object { -not $_.SiteUrl } | Select-Object Title, ID

6 – External sharing on each site

In the admin center, select the arrow on any column header, then Customize columns, and turn on External sharing. To change it, select the site and then Settings > More sharing settings (Microsoft Learn).

Get-SPOSite doesn’t return the sharing setting when it lists all sites, so Get-MttSite reads it per site when you add -IncludeSharing. That made the run 40 seconds instead of 2 on 68 sites, so use it when you need it.

Get-MttSite -IncludeSharing | Where-Object SharingCapability -eq 'ExternalUserAndGuestSharing' | Select-Object SiteUrl, SiteType

PowerShell uses different names from the admin center:

PowerShellAdmin center
ExternalUserAndGuestSharingAnyone
ExternalUserSharingOnlyNew and existing guests
ExistingExternalUserSharingOnlyExisting guests
DisabledOnly people in your organization

Five of my 68 sites allow Anyone links, including MST Intranet, MST-PMO and MST Sales and Marketing.

The function also feeds other reports. Get-MttSite | Get-MttCustomScriptSite works directly. Functions that use PnP PowerShell, like Get-MttUniquePermission, need a sign-in per site, so the GitHub README has a loop for that.

Try it yourself

  1. Install the SharePoint Online Management Shell (Install-Module Microsoft.Online.SharePoint.PowerShell) and sign in as a SharePoint Administrator.
  2. Download Get-MttSite.ps1 from GitHub.
  3. Run Get-MttSite | Export-Csv once and open the file next to the admin center export.
  4. Add -IncludeSharing when you need the sharing setting.

Output columns: SiteUrl, Title, SiteType, Template, Owner, StorageUsedGB, LastContentModified, DaysSinceLastChange, IsTeamsConnected, GroupId, IsHubSite, HubSite, LockState, ArchiveStatus, plus SharingCapability with -IncludeSharing.

Share:
Adnan Amin

Adnan Amin

Adnan Amin is a Microsoft MVP for Microsoft 365 (since 2015) and a Senior Microsoft Consultant. He writes practical guides and PowerShell scripts for SharePoint, OneDrive, Teams and Copilot admins.

More posts by Adnan Amin

Leave a Reply

Your email address will not be published. Required fields are marked *