Permanently Remove Deleted Users from Office 365

When you delete a user from Office 365 they are moved into a recycle bin for 30 days. This enables you to restore the account in case of an accident or to recover user data (emails, office files, etc.).

To purge the deleted user accounts from Office 365 you will need to use PowerShell.

Warning: Be 100% sure you want to completely delete the user account before proceeding.

Step 1. Install Azure Active Directory Module (MSOnline)

Open an elevated Windows PowerShell command and run the following command.

Install-Module MSOnline

Step 2. Connect to Azure AD

Use the below command to connect to Azure AD.


Step 3. List Deleted Office 365 Users

To list all deleted Office 365 user accounts run this command.

Get-MsolUser -ReturnDeletedUsers

Step 4. Permanently Delete Account

To permanently delete a specific account, use this command.

Remove-MsolUser -UserPrincipalName -RemoveFromRecycleBin

To permanently remove all deleted users, use this command.

Get-MsolUser -ReturnDeletedUsers | Remove-MsolUser -RemoveFromRecycleBin -Force

After completing the above steps I’ll check for deleting users again. PowerShell now returns none.

Now I’ll check the Office 365 admin for a list of deleted users.

Success. All Office 365 deleted users have permanently been removed.

Related Articles

2 thoughts on “Permanently Remove Deleted Users from Office 365”

Leave a Comment