I have used this procedure in the past in a few different scenarios. First, I have seen where a user becomes irreversibly corrupted in Azure AD Sync, and changes are no longer syncing to the cloud. Also, I have been a part of a cutover migration in which a mistake was made and a mailbox got associated with the wrong user account in the cloud. In either case, this process provides an easier resolution than remigrating. This process will restore a soft-deleted mailbox to a different mailbox in the cloud.
Side note: I like to do most of my powershell work in ISE. For this process in particular, there will some copying out long GUID values that is much easy if you have the notepad feature of ISE to use.
- Unlicense the user with the mailbox that needs to be restored elsewhere
- Hard delete the user
- (If needed) Created the new user in Office 365 either manually or through directory sync and license this user.
- Connect to Exchange Online through powershell.
- Get the soft deleted mailbox ExchangeGuid from the account you previously deleted using one of the following commandlets:
This will return the alias and ExchangeGuid of all soft deleted mailboxes. You could use this if you have a small tenant and you know there are not very many soft deleted mailboxes:
Get-Mailbox -SoftDeletedMailbox | FL Alias, ExchangeGuid
You can also specify and alias to return the specific ExchangeGuid you are looking for:
Get-Mailbox -SoftDeletedMailbox <alias> | fl ExchangeGuid
6. Get the mailbox ExchangeGuid from the newly created mailbox using the following commanlet. Specify the user with their UPN. (If you have just licensed the mailbox, it may take a few minutes for the mailbox to appear in Exchange Online.)
Get-Mailbox -Identity <UPN> |FL ExchangeGuid
7. Start the mailbox restore process. This will restore the data from the soft deleted mailbox, to the newly created mailbox. You will copy and paste the ExchangeGUID of the soft deleted mailbox after the “-SourceMailbox” parameter, and the ExchangeGUID of the new mailbox after the “TargetMailbox” parameter.
New-MailboxRestoreRequest -SourceMailbox <ExchangeGUID of soft deleted mailbox> -TargetMailbox <ExchangeGUID of new mailbox> -LargeItemLimit unlimited -AcceptLargeDataLoss -BadItemLimit unlimited -AllowLegacyDNMismatch
8. To check progress, use the get-mailboxrestore request.
When this restore has completed, the user will be able to log into the new account and mailbox, and access the mailbox data from the old account.