Skip to content

Remove-HubSiteAssociation

SharePoint Online: Removes a site from its associated hub site

#Requires -Version 5.1
#Requires -Modules Microsoft.Online.SharePoint.PowerShell

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$Site
)

Process {
    try {
        Remove-SPOHubSiteAssociation -Site $Site -ErrorAction Stop
        [PSCustomObject]@{ Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"; Status = "Success"; Message = "Site '$Site' removed from hub association" }
    }
    catch { throw }
}

URL of the site to remove from the hub site

An interactive directory of PowerShell scripts.