To find inactive sites in SharePoint Online, download the SharePoint site usage report with Get-MgReportSharePointSiteUsageDetail and keep the sites whose Last Activity Date is old or missing. It counts file and page activity only, so a site used just for Teams chat can look idle, and it hides site addresses if your tenant conceals names.
| Method | Best fit |
|---|---|
| PowerShell | A CSV of sites with no activity for a set number of days, longest idle first. |
| Admin centre | Reading each site's last activity date in Microsoft's usage report, or a one-off export. |
| Altivane | Recommended for regular reviews, with the days set once, a rating against a threshold and a workbook to keep. |
Before you start
Use an account that can view usage reports, such as Reports Reader or SharePoint Administrator. The PowerShell example requests Reports.; your organisation may require administrator consent.
Last Activity Date is the latest day anyone opened, changed, downloaded or synced a file, created a sharing link or viewed a page, whichever period you ask for. Microsoft says usage reports typically become available within 24 to 72 hours. The report also lists some sites the Active sites page leaves out, such as OneDrives. The examples read and export; they change no site.
Option 1
Find inactive sites with PowerShell
Install the modules once, then connect and export the sites idle for more than 180 days or with no activity date.
# Install once, if the modules are not already installed.
Install-Module Microsoft.Graph.Authentication, Microsoft.Graph.Reports -Scope CurrentUser$ErrorActionPreference = 'Stop'
$days = 180
$utc = [System.Globalization.DateTimeStyles]::AssumeUniversal -bor
[System.Globalization.DateTimeStyles]::AdjustToUniversal
$today = (Get-Date).ToUniversalTime().Date
Connect-MgGraph -Scopes 'Reports.Read.All' -NoWelcome
try {
$download = Join-Path $PWD 'sharepoint-usage-download.csv'
Get-MgReportSharePointSiteUsageDetail -Period D180 -OutFile $download
$sites = @(Import-Csv -Path $download)
Remove-Item -Path $download
$report = @(foreach ($site in $sites) {
if ($site.'Is Deleted' -eq 'True' -or $site.'Site URL' -match '/personal/') { continue }
$idle = $null
if ($site.'Last Activity Date') {
$last = [datetime]::ParseExact($site.'Last Activity Date', 'yyyy-MM-dd',
[System.Globalization.CultureInfo]::InvariantCulture, $utc).ToUniversalTime()
$idle = [int]($today - $last.Date).TotalDays
}
if ($null -eq $idle -or $idle -gt $days) {
[pscustomobject]@{
Url = $site.'Site URL'
Owner = $site.'Owner Display Name'
OwnerAccount = $site.'Owner Principal Name'
Template = $site.'Root Web Template'
LastActivity = $site.'Last Activity Date'
DaysIdle = $idle
StorageGB = [math]::Round([double]$site.'Storage Used (Byte)' / 1GB, 2)
Files = [int64]$site.'File Count'
PageViews = [int64]$site.'Page View Count'
}
}
})
if ($report.Count -eq 0) {
Write-Output "No site has been idle for more than $days days."
} else {
$order = @{
Expression = { if ($null -eq $_.DaysIdle) { [int]::MaxValue } else { $_.DaysIdle } }
Descending = $true
}
$report | Sort-Object $order |
Export-Csv -Path './inactive-sharepoint-sites.csv' -NoTypeInformation -Encoding utf8
Write-Output "$($report.Count) sites are idle for more than $days days or have no date."
}
} finally {
Disconnect-MgGraph | Out-Null
}The CSV has 1 row for each site: those with no activity date first, then the longest idle. The script leaves out deleted sites and OneDrives (addresses with /personal/). Raise or lower $days to widen or narrow the list. For storage against each limit, see how to export site storage usage in SharePoint Online.
Option 2
Review site activity in the admin centre
- Open the Microsoft 365 admin centre for the correct tenant.
- Go to Reports > Usage. If Reports is missing, select Show all first.
- Under Reports, select SharePoint, then the Site usage tab.
- Select Choose columns to add Last activity date (UTC) to the table if it is not shown.
- Select Export to download the report as a CSV file, then sort it by Last activity date (UTC) in Excel. The oldest dates are the sites to review.
This suits a quick look or a one-off file, and it is the same report the script downloads. SharePoint Advanced Management has an inactive site policy too, but creating one saves it in the tenant.
Option 3 ยท Recommended for regular site reviews
Find inactive sites with Altivane
- Open Altivane and choose the tenant.
- Build the tenant's documents with the SharePoint Sites scorecard report in full and set Inactive sites to the number of days without use to flag, starting at 90. Builds start it on Summary, which leaves out the detail tables; Summary only makes every full report run as Summary.
- Open the tenant's Excel workbook and read Inactive Sites for sites not used or changed for longer than that, longest first, with Owners, Last used, Days unused and Storage (GB).
- Read SharePoint Sites Summary for the count and SharePoint Sites for each site's Last used date.
Altivane reads the same usage report and dates each site by its Last used: the later of its last activity and, with the admin tier (Sites. on the SharePoint API), its last content change. The scorecard rates inactive sites as a share of all sites, Warning at 10% and Critical at 30% to start. The build also writes the tenant's Word report. The report needs a tenant signed in with a certificate.
Common questions
Why are the site addresses and owners hidden?
Microsoft hides user, group and site names in usage reports by default, site addresses included. A Global Administrator can turn that off in the Microsoft 365 admin centre under Settings > Org settings, the Services tab, Reports, by clearing Conceal user, group, and site names in all reports. Microsoft logs this in the Microsoft Purview audit log, so check your privacy rules first. Altivane cannot match a concealed report to sites, so without the admin tier it dates each site from its creation and older sites look unused.
Is a site inactive if people read it but never edit it?
No. Opening a file or viewing a page moves Last Activity Date, so a site that is read but not edited is still active. Messages in a team's channels are not counted, so a team site used only for chat can look idle.
Are OneDrives included?
No. The script and Altivane's SharePoint Sites scorecard report leave out OneDrives. For those, see how to export OneDrive storage usage in Microsoft 365. Altivane's OneDrive scorecard report lists the ones not used recently, using the same Inactive sites setting.
Microsoft references
Technical references checked on 5 October 2026. The example scripts have been reviewed and syntax checked; they have not been run against a live tenant.