Get-PnPSubWebs

Returns the subwebs of the current web

Syntax

Get-PnPSubWebs
   [-Includes <String[]>]
                 [-Identity <WebPipeBind>]
                 [-Recurse [<SwitchParameter>]]
                 [-Web <WebPipeBind>]
                 [-Connection <SPOnlineConnection>]

Examples

------------------EXAMPLE 1------------------

Get-PnPSubWebs

Retrieves all subsites of the current context returning the Id, Url, Title and ServerRelativeUrl of each subsite in the output

------------------EXAMPLE 2------------------

Get-PnPSubWebs -Recurse

Retrieves all subsites of the current context and all of their nested child subsites returning the Id, Url, Title and ServerRelativeUrl of each subsite in the output

------------------EXAMPLE 3------------------

Get-PnPSubWebs -Recurse -Includes "WebTemplate","Description" | Select ServerRelativeUrl, WebTemplate, Description

Retrieves all subsites of the current context and shows the ServerRelativeUrl, WebTemplate and Description properties in the resulting output

------------------EXAMPLE 4------------------

Get-PnPSubWebs -Identity Team1 -Recurse

Retrieves all subsites of the subsite Team1 and all of its nested child subsites returning the Id, Url, Title and ServerRelativeUrl of each subsite in the output

Parameters

-Connection

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type:SPOnlineConnection
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Identity

If provided, only the subsite with the provided Id, GUID or the Web instance will be returned

Type:WebPipeBind
Position:0
Accept pipeline input:True
Accept wildcard characters:False
-Includes

Specify properties to include when retrieving objects from the server.

Type:String[]
Position:0
Accept pipeline input:False
Accept wildcard characters:False
-Recurse

If provided, recursion through all subsites and their children will take place to return them as well

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Web

The web to apply the command to. Omit this parameter to use the current web.

Type:WebPipeBind
Position:Named
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.SharePoint.Client.Web