Resolving issues with duplicate mailboxes in Exchange Hybrid

When setting up an Exchange Hybrid the msExchMailboxGuid normally helps Office 365 to determine whether a mailbox should be created in Exchange Online or if a mailbox already exists on the on-premise server. In the not so perfect world you may however find yourself in a situation where a user suddently has two mailboxes, one O365 and one on-prem.

If Exchange is the first workload being migrated the most convinient method may be to move the AD account to an OU that’s not being synced. This will cause the user to be moved to “Deleted Users” in O365 and from there you can completly remove the account using PowerShell

Remove-MsolUser -UserPrincipalName user@technut.se -RemoveFromRecycleBin

After running the cmdlet the user can be moved back to a synchronized OU and if things are setup correctly the account should be synced without having a mailbox created.

When there’s other data involved

If users have other workloads onboarded in O365 the method above may not be a feasable option as all data is deleted in the process. Instead you may proceed with this option. First of all you need to remove the license from the account (or at least the Exchange part). This will soft-delete the mailbox but re-adding the license would re-connect the mailbox and you’d be back where you started. After removing the license and verifying that the mailbox is removed (using PowerShell or ECP). Run the following cmdlet.

Set-User user@technut.se -PermanentlyClearPreviousMailboxInfo

This cmdlet removes the connection between the user and the inactive mailbox. After running the cmdlet you can re-add the license without having the mailbox re-connected.

Dealing with inherited licenses

If your organization is using Azure AD licensing based on dynamic groups, removing licenses is a bit of a struggle as you can’t except a single user from the group easily. My suggestion is using a specific value in one of the ExtensionAttibute to temporarily exclude a user. It still takes some time but it’s doable.

1 thought on “Resolving issues with duplicate mailboxes in Exchange Hybrid”

  1. The second option with Set cmd , I am not sure if the user who has the duplication mailbox created have already worked and have data , would that data be lost or this option is feasible users who have not started yet and have no data

Leave a Reply

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