In this article we can see how to remove an external user from SharePoint online (SPO) with the help of power shell. Execute the powershell scripts in the below order to remove an external user from SPO
Steps
1. Import-Module "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell"
2. Connect-SPOService -Url https://xyzcorp-admin.sharepoint.com -credential abc@xyzcorp.net
3. $user = Get-SPOExternalUser -Filter i:0#.f|membership|live.com#externaluser@hotmail.com
$user = Get-SPOExternalUser -Filter external2@outlook.com
4. write-host $user.uniqueid
5. Remove-SPOExternalUser -UniqueIDs @($user.UniqueId)
The above steps would remove the user from User Information list at Site Collection Level and External accounts List from Tenant Admin at site Collection Level
Leave a comment