Fixing the "ExchangeGuid is mandatory on UserMailbox" issue

During a recent Office 365 migration project I ran into an issue on the on-premises Exchange 2013 platform, when trying to create Mail User objects for the migrated mailboxes.

The following error appeared when adding a new Mail User:

ExchangeGuid is mandatory on UserMailbox.

Database is mandatory on UserMailbox.

clip_image001

After first verifying that the Exchange server was able to route mail to the Exchange Online, I started looking at the user accounts in Active Directory, using the Attribute Editor in Active Directory Users and Computers.

Going through the users attributes, I noticed that the Exchange attribute msExchHomeServerName was still populated with a LegacyExchangeDN value, despite the users did not any longer have mailboxes in the on-premises Exchange organization.

clip_image002

The root cause behind this could be that an internal mailbox decommissioning process failed, so the msExchHomeServerName attribute was not cleared properly on the user objects, as it should have been.

Before proceeing with the change, I first exported the UserPrincipalName and msExchHomeServerName values to a CSV file – just as a precaution.

To first view the output:

Get-ADUser –filter * -Properties msExchHomeServerName | Where-Object {$_.msExchHomeServerName –ne $null} | Sort-Object -Property UserPrincipalName | Select-object Userprincipalname, msExchHomeServerName

clip_image003

And to export the output to a CSV file:

Get-ADUser –filter * -Properties msExchHomeServerName | Where-Object {$_.msExchHomeServerName –ne $null} | Sort-Object -Property UserPrincipalName | Select-object Userprincipalname, msExchHomeServerName | Export-CSV C:\Temp\ExchHomeServer.csv –NoTypeInformation

After clearing the msExchHomeServerName attribute, I could create the Mail User objects using the Exchange Admin Center og using the Exchange Management Shell.

clip_image004

Shortly after, the mail flow started to route messages correctly to the users new Exchange Online mailboxes.

clip_image005

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.