This article helps you to solve the Set-SyncMailUser failed error.
In a Hybrid environment, a staff member with migrated (remote) mailbox left from the company and license was removed. User is moved into a non-sync OU and M365 mailbox is moved into deleted users. After the grace period, mailbox is deleted. The same user comes back in the company a few months later (after the grace period of the mailbox) and the same AD account is re-enabled and re-synced with M365. In the on-premises exchange console the same mailbox is showing as Remote mailbox but in Exchange online, no mailbox. I checked the Error field via MSOL, but showing nothing, literally empty space.
If they rejoin you will of course need to give them a fresh license via the Microsoft 365 Admin portal however when this happens you get the error ‘Exchange: An unknown error has occurred. Refer to correlation ID: <correlation ID>’. You will receive this message.
To fix this do the following:
- On the Microsoft 365 portal, find the user and in the licenses section remove the ‘Exchange Online (plan 2)’ and save, once this is done run an AAD Connect sync (this will ensure no new mailboxes are created while you are fixing the current one).
- Go onto your on-premises exchange server and open up the exchange management console, from here you need to find the user and reset the ExchangeGUID.
- To reset the ExchangeGUID in on-premises, use the command. Set-RemoteMailbox “User email address” -ExchangeGUID 00000000-0000-0000-0000-000000000000.
- Go back to your AAD Connect server and run the sync. To check the changes in cloud, Get-MailUser “User email address” | fl ExchangeGUID.
- If you are having issues in updating ExchangeGUID, we do have one method that you can try by clicking here.
- Reapply the exchange license you removed earlier and wait for the new mailbox to create, you should notice that the errors disappear by this point, however, however you aren’t done yet.
- Connect to Exchange Online Management Shell using a Global Admin or Exchange Online Administrator account. Now run the command. Get-Mailbox “User email address” -SoftDeletedMailbox | fl ExchangeGUID
- Now, you have the guid of the disconnected mailbox. Next, you will need the one of the new mailbox, to get this simply input the command, Get-Mailbox “User email address” | fl ExchangeGUID
- You have both the guid’s and you are ready to restore the mailbox using a mailbox restore request. To do this, use the command, New-MailboxRestoreRequest -SourceMailbox “ExchangeGUID of the disconnected mailbox” -TargetMailbox “ExchangeGUID of the new mailbox” -AllowLegacyDNMismatch
- Now simply wait for the mailbox to restore and job done.
That’s how you can solve the Set-SyncMailUser failed error.
Now I’d like to hear from you:
Did I miss anything? Or maybe you have a question about something that I covered.
Either way, I’d like to hear from you. So go ahead and leave a comment below.