Permanently Remove Deleted Users from Office 365

by Robert Allen

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.

Connect-MsolService

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 testuser@activedirectorypro.com -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

Recommended Tools

  • AD Cleanup Tool - Find stale and inactive user and computer accounts in Active Directory. Export, disable, move or delete the stale accounts to increase security.
  • AD User Creation Tool - Bulk import or update Active Directory user accounts. Add users to groups, import into OUs, set multiple attributes and more.
  • NTFS Permissions Tool - Scan and audit NTFS folder permissions. See which users and groups have access to what.
  • AD Reporting Tool - Over 200 reports on users, computers, groups, OUs and more. Customize reports or create your own reports with the report builder.

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

Leave a Comment