Menu Close

[SOLVED] Set-SyncMailUser Failed In Microsoft 365

This article will help you solve the Set-SyncMailUser failed error.

In a hybrid environment, a staff member with a migrated (remote) mailbox left the company and the license was removed. A user is moved into a non-sync OU and M365 mailbox is moved into deleted users. After the grace period, the mailbox is deleted. The same user comes back into 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 a remote mailbox, but in Exchange Online, there is no mailbox. I checked the Error field via MSOL, but it showed nothing.

If they rejoin, you will of course need to give them a fresh license via the Microsoft 365 admin center, 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.

set-syncmailuser failed

To fix this, do the following:

  • On the Microsoft 365 admin center, find the user and in the licenses section, remove “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 Exchange GUID.
  • 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, use Get-MailUser “User email address” | fl ExchangeGUID.
  • If you are having issues 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 be created. You should notice that the errors disappear by this point, however, you aren’t done yet.
  • Connect to the 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 one of the new mailbox. To get this, 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 be restored, and the job is 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.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *