Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Managing Site Hub in Sharepoint Online
//Sharepoint Online - Site hub management
//Please connect first with - PS> Connect-SPOService -url https://<your tenant>
//Get all sites containing url sites/mkt
Get-SPOSite -limit all | select url,ID | where-object {$_.Url -like "*sites/mkt*"}
//Remove a site from the recycle bin
Remove-SPODeletedSite -Identity
//Register a site as Site Hub - principals should be default admin group
Register-SPOHubSite -site "" -principals $null
//Set a site as Site hub
Set-SPOHubSite -Identity
//Associate one site with a Hub Site
Add-SPOHubSiteAssociation -hubsite
//associate multi sites into Hub SIte
$allsites = Get-SPOSite -limit all | select url,ID | where-object {$_.Url -like "*sites/mkt*"}
foreach($a in $allsites ){
Add-SPOHubSiteAssociation $a.url -HubSite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.