Skip to content

Revoke-HubSiteRights

SharePoint Online: Revokes rights for specified principals to a hub

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

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

Process {
    try {
        $cmdArgs = @{ ErrorAction = 'Stop'; Identity = $Site }
        if (-not [System.String]::IsNullOrWhiteSpace($Principals)) { $cmdArgs.Add('Principals', $Principals.Split(',')) }
        $result = Revoke-SPOHubSiteRights @cmdArgs | Select-Object *
        if ($null -ne $result) { foreach ($item in $result) { $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force } }
    }
    catch { throw }
}

URL of the hub site

Comma-separated list of principals to revoke permissions from

An interactive directory of PowerShell scripts.