Delete a user from Deleted Users in Office 365

When you delete a user in Office 365, it adds the user to “Deleted Users” for 30 days meaning you can’t reuse the UPN/username during this time. It is possible to delete a user from Deleted Users in Office 365, however it does require Powershell.

You will require Azure Active Directory Module for Windows PowerShell to be installed on your computer to do this – see how to install it here.

Delete a user from Deleted Users in Office 365
  1. Connect to MSOnline by running the below command and entering your administrator username and password when requested.
    Connect-MsolService
  2. (Optional) Run the following command to see a list of users currently in Deleted Users.
    Get-MsolUser -ReturnDeletedUsers
  3. Finally run the following (adjusting the user@ramblingtechie.co.uk with the user you want to remove) to completely delete a user form deleted users in Office 365. Be aware this is irreversible once run, so be certain you want to completely remove the account before doing so.
    Remove-MsolUser -UserPrincipalName user@ramblingtechie.co.uk -RemoveFromRecycleBin

 

The user will now be completely removed. To remove all users that are currently in deleted users, run the following command:

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

Removing -Force from the end will result in you being asked to confirm each deletion.




Leave a Reply