How to Use PowerShell to Permanently Delete a User in Office 365
March 16, 2016 / / Comments Off on How to Use PowerShell to Permanently Delete a User in Office 365
< 1 minute read

Say you’ve recently deleted some users in your Office 365 admin console. By default, when you delete a user, that user is placed in the Recycle Bin where their settings live for another 30 days before that user is permanently deleted, kind of like a soft delete.
In the case where you want to delete that user before the 30 days are up, here’s how to use PowerShell to clean your recycle bin.
- First, make sure you are connected to PowerShell. This article shows you how to connect Office 365 to PowerShell.Â
- Once you’ve confirmed you’re connected, type this cmdlet to see the current user profiles that are stored in your deleted folder:
- Get-MsolUser – ReturnDeletedUsers
- This command will show you all of the users that are currently stored in the Deleted Users/Recycle Bin folder, and have not yet been permanently deleted because 30 days have not passed since they were first put in this folder.
- To delete a certain user in that list, say I wanted to expedite the permanent deletion of one of the users returned in this list, I would type in this cmdlet:
- Remove-MsolUser -UserPrincipalName “[user’s email address]” -RemoveFromRecycleBin
- You’ll be asked to confirm if you definitely want to permanently delete this user.
- Type Y for Yes.
- You have now successfully deleted that user permanently.
- To confirm that it’s been completely deleted, type this cmdlet:
- Get-MsolUser-ReturnDeletedUsers
- The results returned here should no longer show that user
Click here for more information on these cmdlets relating to deleted user accounts.