Display All Subsites Within a Site Collection


Scenario/Problem: You need to obtain a site reference and therefore need a listing of available subsites within a specific site collection.


Solution: Use the Get-SPWeb cmdlet with a wildcard Identity path.

To display all subsites within a site collection, you need to use the Get-SPWeb cmdlet with the Identity parameter. If you provide only the site collection URL, Get-SPWeb returns only the site collection web object. Therefore, you need to provide a wildcard path, as shown in Listing 8.11.

Listing 8.11. Displaying All Subsites Within a Site Collection


Get-SPWeb -Identity "http://sp2013/sites/sitecol/*"


You can also use the Site parameter instead of the wildcard Identity parameter to retrieve all webs, including the site collection web. Listing 8.12 shows a sample command line.

Listing 8.12. Displaying All Webs Within a Site Collection


Get-SPWeb -Site "http://sp2013/sites/sitecol"


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.84.155