Exchange Online Dual Mailbox Issue. I have a mailbox on-premise and Exchange Online for the same user


Sometimes things happen. Migration failed, interns assigning a license to a user when their mailbox is on premise, or some other kind of administrative mistake. Now you realize you have a mailbox on premise and a mailbox in O365. In order to fix the problem, you have to remove one of the accounts. The easiest fix is to remove the cloud account and migrate the on premise account. The reason you want to keep the on premise account is mainly for successful authentication, redirects, and mailflow. Below are the steps to accomplish the task of successfully removing and resyncing the user’s account. This process will save the current mailbox data in a soft deleted state, removed the MSOL account in O365, resync the AD account on prem to O365 and re-create the mailbox.

You know you are running into this issue if you run Get-mailbox in Exchange Powershell on-premise, and you run Get-mailbox in Exchange Online Powershell and both outputs are showing a user mailbox.

This is essentially what will need to be done. In Powershell connected to Exchange Online, please run the following steps:

  1. Check to see if the current mailbox for Steve is on litigation hold. If not, Set the mailbox on litigation hold to save the data.
    1. Set-Mailbox [insert alias] -LitigationHoldEnabled $true
  2. Verify the litigation hold is in place. *May take up to 60 minutes, but is typically pretty quick.
    1. Get-Mailbox [insert alias]  | fl *lit*
  3. Get more the mailbox information. We will need the GUID for later.
    1. Get-Mailbox [inser alias | fl userpprincipalname,guid
  4. Get-msol user information of the account that we need to purge.
    1. Get-msoluser -userprincipalname [insert upn of user] | fl
  5. Delete the old MSOL account information using the objectID from step 5. (Yes, you need to run both cmdlets here)
    1. Remove-msoluser -objectid
    2. Remove-msoluser -objectid -removefromrecyclebin
  1. Verify the user has been deleted.
    1. Get-msoluser -objectid -returndeletedusers
  2. Run Dirsync. The Old account should be gone from delete items. You may need to run Dirsync twice. Verify that the new  account has synced to O365 and is showing “Sync with Active Directory” in the O365 admin portal.
  3. Migrate on premise mailbox to EXO.
  4. Assign a license to the new mailbox.
  5. In Exchange Online Powershell, get the mailbox information for the new mailbox. Copy the GUID.
    1. Get-Mailbox [user alias] | fl name,GUID
  6. Now merge the data to the new mailbox.
    1. New-mailboxrestoreRequest -sourcemailbox [Guid of old mailbox from Step4] -targetmailbox [GUID of new mailbox step 11] -allowLegacyDNMismatch
  7. Verify the mailbox restore is in place.
    1. Get-mailboxrestorerequest
  8. Verify the data is restored and the mailbox is healthy.
  9. You can now remove litigation hold for the old mailbox if you chose. If you don’t then the mailbox will just be retained for the length of the specified litigation hold.

 

Reply to this thread if you have questions or concerns.

Comments (1)

  1. turbomcp says:

    good one
    thanks

Skip to main content