Permanently delete users from Office 365

Permanently delete users from Office 365

How to permanently delete users from Office 365/Microsoft 365? When you remove users from Office 365/Microsoft 365, they will move to the recycle bin. This is known as soft-delete. A soft-delete user account will stay for 30 days. After that, it will automatically be deleted by Microsoft. This is known as hard-delete. What if you don’t want to wait and like to remove the deleted users manually? Let’s have a look at how to force delete users from Office 365 with PowerShell.

Soft-deleted user vs. Hard-deleted user

·         soft-deleted user is a user that has been deleted and has still been in the Azure Active Directory recycle bin for less than 30 days.

·         hard-deleted user is a user that has been deleted and is not available in the Azure Active Directory recycle bin.

Find deleted users in Microsoft 365 admin center

You can find the deleted users in Microsoft 365 admin center. Navigate to Users > Deleted Users.


You can’t remove the deleted users from Microsoft 365 admin center. The only possible way to remove the deleted Office 365 users is with PowerShell.

Let’s look at that in the next step.

Connect to Azure AD with PowerShell

Install and connect to Azure AD with PowerShell. After that, run the Connect-MsolService cmdlet to initiate a connection with Azure Active Directory.


After running the above cmdlet, the sign-in window shows up. Fill in the credentials and sign in.

Connect-MsolService


After connecting to Azure AD with PowerShell, let’s get the deleted Office 365 users.

Get Office 365 deleted users

Find the Office 365 deleted users with PowerShell. Run the Get-MsolUser cmdlet, including the -All switch and -ReturnDeletedUsers switch.

 


Remove specific deleted Office 365 user

Permanently remove a single deleted user.

Remove-MsolUser -UserPrincipalName "user3@waytoinfotech.com" -RemoveFromRecycleBin


Remove all deleted Office 365 users

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

 

After running the above command, we can verify that the deleted user's page is empty.


 

Share :

Add New Comment

 Your Comment has been sent successfully. Thank you!   Refresh
Error: Please try again