How to inspect locked and archived SharePoint sites
Can anybody change this site at all?
30-second answer
Get-PnPTenantSite -Identity https://contoso.sharepoint.com/sites/oldproject |
Select-Object Url, LockState, ArchiveStatus
LockState is Unlock, ReadOnly or NoAccess. ArchiveStatus is
NotArchived or an archival state from Microsoft 365 Archive.
What this proves
Whether the site is in a state where content changes are possible. A locked or archived site cannot be changed by its users, whatever their permissions say.
What it does not prove
- Why it was locked or archived. The state records the decision, not the reason: legal hold, decommissioning, cost management and abandoned cleanup all look the same here.
- That the content is gone. Archived and read-only content still exists, still appears where policies let it, and still has to be counted in migrations and audits.
PowerShell
Get-PnPTenantSite |
Where-Object { $_.LockState -ne 'Unlock' -or $_.ArchiveStatus -ne 'NotArchived' } |
Select-Object Url, LockState, ArchiveStatus
Example output
Url LockState ArchiveStatus
--- --------- -------------
https://contoso.sharepoint.com/sites/legacy ReadOnly NotArchived
https://contoso.sharepoint.com/sites/2019bid Unlock Archived
Explanation
These two properties change what every activity metric means. A site nobody has edited in two years reads as abandoned, unless it is read-only, in which case nobody could have edited it: the inactivity is the consequence of a decision, not a signal of neglect. Any staleness report that does not first exclude undecidable sites files deliberate archives next to genuine abandonment, and both readings suffer for it.
Production considerations
- Both properties come from the tenant record; the admin-centre connection and a SharePoint administrator role are required.
NoAccesssites refuse even reads. Expect collection to fail on them, and record the refusal as its own fact rather than as an empty site.
References
- Lock and unlock sites (Microsoft Learn)
- Microsoft 365 Archive (Microsoft Learn)
