In SharePoint 2019, I face this error Sites that have subsites or certain apps can't be deleted SharePoint 2019 but I need to know How many subsites per site collection and list all susbites using Power Shell before deleting them? How can I do that?
You can get all subsites that have been created under a specific site collection by doing the following:
Run the below cmdlet to list all subsites.
Get-SPsite -Identity "Site Collection URL" | get-spweb -Limit all
To get the count of all subsites that have been created under a specific site collection, you have to do the following:
Run the below cmdlet to count all subsites for a site collection.
$SubSiteCount = (Get-SPsite -Identity "Site Collection URL" | get-spweb -Limit all).count Write-Host "the number of subsites per site collection is" $SubSiteCount -ForegroundColor green
See Also: Get All Site Collections and SubSites Per Farm
1.1k questions
679 answers
459 comments
193k users
Related Activities
Categories
Most popular tags