Forum Discussion
Damien Flood
Apr 11, 2017Iron Contributor
Site Collection: Get all subwebs
Hi all,
Looking in PnP PowerShell examples and I am able to get all the subwebs of a site collection.
But some of these subwebs also have subwebs.
Not being a PS expert wondering if there is quick way to list all of the subwebs withing the subswebs.
Cheers
- You need to use
Get-PnPSubWebs -Recurse
4 Replies
- You need to use
Get-PnPSubWebs -Recurse- paulpaschaBronze Contributor
Ah, even better :-)
- Damien FloodIron ContributorThanks so much!
- paulpaschaBronze Contributor
Hi
I found this PowerShell script that doesn't make use of PnP Powershell. It recursively loops through all webs in a site collection based on methods available in CSOM. You could write such a script to do something similar using the PnP PowerShell approach but I guess this provides just what you are looking for.
https://gallery.technet.microsoft.com/office/Script-to-get-All-Webs-in-c2c1cdaf
Hope this helps