March 24, 2018
| by
iaur
| posted as
Adminstration , Microsoft 365
Scenario
You want to delete user using PowerShell You want to purge delete user from the recycle bin
Steps
Connect to MSOL using PowerShellRun below command as desired
Remove-MsolUser -UserPrincipalName ‘DemoUser5@Priasoft.mail.onmicrosoft.com’ -RemoveFromRecycleBin
This cmdlet will delete user and purge it from the recycle bin. Replace DemoUser with the UPN of your target user
Get-Msoluser -ReturnDeletedUser |fl
This cmdlet will display ALL users that are on the recycle bin
Get-Msoluser -ReturnDeletedUser |select UserPrincipalName
This cmdlet will sort ALL soft-deleted users by UPN
Get-Msoluser -ReturnDeletedUser | Remove-MsolUser -RemoveFromRecycleBin -Force
This cmdlet will force delete ALL users found in the recycle bin
Force delete DirSynced User
Get-msoluser -UserPrincipalName ‘ron@faceresionem.onmicrosoft.com’ | Remove-MsolUser -Force | Remove-MsolUser -RemoveFromRecycleBin
example user is ron