Deleting MSOL user using PowerShell

March 24, 2018 | by iaur | posted as Adminstration, Microsoft 365


  • You want to delete user using PowerShell
  • You want to purge delete user from the recycle bin


  1. Connect to MSOL using PowerShell
  2. Run below command as desired
Remove-MsolUser -UserPrincipalName ‘’ -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 ‘’ | Remove-MsolUser -Force | Remove-MsolUser -RemoveFromRecycleBin
example user is ron
-UserPrincipaIName . com 
PS C: \ 
Get -msoluser 
PS C: \ 
PS C: \