30-second answer
$modern = @(Get-PnPPage)
$library = Get-PnPList -Identity 'SitePages'
"{0} modern, {1} in the library" -f $modern.Count, $library.ItemCountTwo counts from two sources. Get-PnPPage returns the pages it can read as
modern client-side pages; the library item count is everything in Site
Pages.
What this proves
How many pages the modern page API returns for this site, and how many items the Site Pages library holds in total. The difference is an upper bound on pages that are something else.
What it does not prove
- The difference is not "classic pages". A page can be absent from
Get-PnPPagefor reasons other than being classic: it may be unreadable to your identity, or not a page at all (folders and templates live in the same library). The honest name for the difference is "in the library and not returned as modern". - Nothing about subsites. Both calls answer for the connected web only.
PowerShell
$modern = @(Get-PnPPage)
$inLibrary = (Get-PnPList -Identity 'SitePages').ItemCount
$rest = [math]::Max($inLibrary - $modern.Count, 0)
[pscustomobject]@{
Modern = $modern.Count
InLibrary = $inLibrary
NotReturnedAsModern = $rest
}Example output
Modern InLibrary NotReturnedAsModern
------ --------- -------------------
9 11 2Explanation
Reconcile the counts before believing either. On a real tenant, one site reported 9 pages in the library while the page API could inspect 8 and failed on 7 of them: numbers that cannot all be true at once. When the parts do not add up to the whole, the correct reading is that the collection is invalid, not that the site has negative classic pages. Arithmetic that cannot be true is a finding about the collector.
Production considerations
Get-PnPPagereads each page; on large Site Pages libraries this is many requests, not one. Consider date filters when sweeping a tenant.- Site read access is enough for both calls.
- Folders in Site Pages count toward
ItemCount. Expect small, explainable differences even on healthy modern sites.
Related governance rules
SPO-MODERN-001: classic publishing infrastructure enabled
References
- Classic publishing sites and the modern experience (Microsoft Learn)
- Get-PnPPage (PnP PowerShell)
Found something wrong? Suggest a correction. The article source is not public; the engine it cites is.
What this answer underwrites
The engine reads these Microsoft operations to collect evidence, so what is established here is what those collectors rest on.
modernityhow one site is built: template, branding, publishingpermissionsevery visible list on a site, and its inheritance