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.
Get-SPWeb -Identity "http://sp2013/sites/sitecol/*"
You can also use the Site
parameter instead of the wildcard Identity
parameter to retrieve ...
Get PowerShell™ for SharePoint® 2013 How-To now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.