question

TanHuynh-3201 avatar image
0 Votes"
TanHuynh-3201 asked MichaelHan-MSFT edited

SPO - Powershell - Filtering subsite

Hello everyone,

I have many subsites and I would like to target only one using below but it does not seem to work. Is there another way to filter? Thanks.

Get-PnPSubWebs -Recurse | Where-Object ($_.ServerRelativeUrl -contains "/sites/main/site1")

office-sharepoint-onlinesharepoint-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered

Hi @TanHuynh-3201,

You need to use braces { } instead of Parentheses ( ), like the below.


 Get-PnPSubWebs -Recurse | Where-Object {$_.ServerRelativeUrl -contains "/sites/main/site1"}



If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

TanHuynh-3201 avatar image
0 Votes"
TanHuynh-3201 answered

Thank you Michael, works now. I should have known :)

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.