To permanently delete a guest user in your Office 365, follow the steps below.
(1) Check that the account is still active
If your guest user email address is : user1@domain.com then his UserPrincipalName is user1_domain.com#EXT#@tenant.onmicrosoft.com
To check that the guest is still active, use the command lines below
$A = user1_domain.com#EXT#@tenant.onmicrosoft.com Get-MsolUser -UserPrincipalName $A
(2) How to delete guest user
Remove-MsolUser -UserPrincipalName $A
(3) Check that guest user account is present in recycle bin
Get-MsolUser -All -ReturnDeletedUsers | ? {$_.userPrincipalName -eq $A}
(4) How to permanently remove the guest account
Remove-MsolUser -UserPrincipalName $A -RemoveFromRecycleBin
Voilà 🙂
Merci beaucoup
LikeLike
When I run this command: Get-MsolUser -All -ReturnDeletedUsers | ? {$_.userPrincipalName -eq $A}
It returns the GUEST account that I deleted. However, when I run this command: Remove-MsolUser -UserPrincipalName $A -RemoveFromRecycleBin
I gives this error:
Remove-MsolUser : User Not Found in the Microsoft Online directory Deleted Users container.
LikeLike