Restore deleted Office 365 mailbox via PowerShell
So you’ve deleted an Office 365 user and need to get them back. Restore deleted Office 365 mailbox via PowerShell
First off, you need to connect to Office 365 via PowerShell. You can find the instructions on how to do that here.
After you’ve done that, you simply need to run the following:
Undo-SoftDeletedMailbox firstname.lastname@example.org -WindowsLiveID email@example.com -Password (ConvertTo-SecureString -String ‘!!P@55w0rd!!’ -AsPlainText -Force)
The above will restore the mailbox firstname.lastname@example.org and reset their password to !!P@55w0rd!!. Once restored, you will need to assign the account a license. Give it some time and you should see the mailbox come back.
*Note, do not be alarmed if it says that it’s ‘setting up a mailbox’. It’s not necessarily setting up a new mailbox.