Skip to content

Instantly share code, notes, and snippets.

@jcallaghan
Created February 14, 2019 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcallaghan/e37405421625c907cf36729030b13df6 to your computer and use it in GitHub Desktop.
Save jcallaghan/e37405421625c907cf36729030b13df6 to your computer and use it in GitHub Desktop.
# Get Hub sites
Connect-SPOService -Url "https://[tenant]-admin.sharepoint.com"
$spoHubSites = Get-SPOHubSite
foreach($hub in $spoHubSites){
$hubSiteId = $hub.SiteId
Write-Host "$($hub.Title) ($($hub.SiteUrl))" -ForegroundColor Yellow
$spoSites = Get-SPOSite -Limit All
foreach ($site in $spoSites) {
$siteDetailed = Get-SPOSite -Detailed $site.Url
if($siteDetailed.HubSiteId -eq $hubSiteId){
write-host " $($site.Title) ($($site.Url))"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment