Skip to content

Remove-ExternalUser

SharePoint Online: Removes an external user

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

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

Process {
    try {
        $cmdArgs = @{ ErrorAction = 'Stop'; UniqueID = $UniqueID; Confirm = $false }
        $result = Remove-SPOExternalUser @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 }
}

ID that identifies the external user based on their Windows Live ID

An interactive directory of PowerShell scripts.