Forum Discussion

Damien Flood's avatar
Damien Flood
Iron Contributor
Apr 11, 2017
Solved

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

4 Replies

  • paulpascha's avatar
    paulpascha
    Bronze 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

     

Resources