Today a customer had created a new AD account for a user because the old AD account kept becomming locked. The new AD account already had gotten synced to Office 365 and gotten a new mailbox. Customer wondered how he could move the mailbox over to the new account, and again give the new account the same email address as the old account.
I deleted the old AD account and let the change sync to Azure AD. Now i could give the new AD account the old UPN address.
Now we needed to use the New-MailboxRestoreRequest commandlet. First we needed to have the Exchange online GUID for the old and new mailbox.
This gives us the old Exchange GUID:
$old = (get-mailbox -identity ”ola nordmann” -SoftDeletedMailbox).exchangeguid
and this to get the new mailbox GUID:
$new = (get-mailbox -identity “ola nordmann” ).exchangeguid
Now we can submit the restore request:
New-MailboxRestoreRequest -sourcemailbox $old.guid -targetmailbox $new.guid -AllowLegacyDNMistmatch -verbose
You can check status of the restore by using:
If you for example get a fail, you can check the restore report by running this command:
Get-MailboxRestoreRequestStatistics -identity «ola nordmann» -includereport | FL