Question

I'm trying to list sites that are associated to a hub site from a PowerShell script. I'm using Microsoft.Online.SharePoint.Powershell.

I tried :

Get-SPOSite -Filter "HubSiteId eq ""121c78fe-bd38-474a-b6a7-1a7be148e8e8"""

However it fails with :

Get-SPOSite : Syntax error in the filter expression 'HubSiteId eq "121c78fe-bd38-474a-b6a7-1a7be148e8e8"'.

What's the proper way to get these sites ?

I also tried :

Get-SPOSite -Limit all | ? { $_.HubSiteID -eq [guid]"121c78fe-bd38-474a-b6a7-1a7be148e8e8" }

Nothing is returned. It seems that HubsiteId is not retrieved as all sites have an empty guid with this command, whilst retrieving a single one shows the correct hubsiteid.

-Detailled switch didn't help though

Was it helpful?

Solution

Using this module : "SharePointPnPPowerShellOnline" you can use : Get-PnPHubSiteChild -Identity "URL of your hub site".

Get-PnPHubSiteChild

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top