In this blog post, I’ll show you how to restore a deleted user account in Office 365 using the Office 365 Admin Center Portal and Office 365 PowerShell.
When an Office 365 user account or a user mailbox gets deleted, the account isn’t permanently deleted immediately.
Office 365 keeps deleted accounts for 30 days, during that time we can restore the accounts using the Admin Center or the Office 365 MSolService PowerShell module.
Restore User Using the Portal
To restore a deleted user using the portal, open the Office 365 Admin Center console, expand Users -> Deleted Users
In the deleted users page, click on the user and click on restore
Select how you would like to reset the password and click restore
Restore User Using PowerShell
To restore the user account user PowerShell please use the MSolServices module.
Please note: You must use the MSolService PowerShell module to restore users using PowerShell, Version 2 of the module will not work.
First, log in to the Service using:
$UserCredential = Get-Credential Connect-MsolService -Credential $UserCredential
Once connected, run the cmdlet below to view all the deleted users
get-msoluser -all -ReturnDeletedUsers
To restore a user from the list run the cmdlet below with the User’s UPN.
Restore-MsolUser -UserPrincipalName email@example.com