Occasionally after migrating a mailbox from an on-premises Exchange server to Exchange Online the user is unable access their mailbox using Outlook, however the Office 365 Outlook Web Access (OWA) application is functional. Often (but not always) the migration batch report will contain users that have “Completed with Errors” or “Completed with Warnings”.

Commonly this is caused by the migration process failing to update the on-premises object and convert it into a mail-enabled user, often due to issues with inheritable permissions or unsupported characters. This critical step retains relevant information to populate the Global Address List, while clearing some attributes that block Outlook from performing an autodiscover operation to locate the mailbox on Office 365.

Additionally the process sets the targetAddress attribute to allow Exchange to correctly route mail to the Exchange Online mailbox. In this situation it’s likely that you will need to complete the conversion from mailbox to a mail enabled user manually. Microsoft has made the KB2745710 article available recommending a process for resolving the issue.

Unfortunately, running “Disable-Mailbox” will result in the user losing their proxy and X500 (LegacyExchangeDN) addresses which will likely create more problems. I have put the following simple script together that will convert an on-premises User Mailbox into a Remote Mailbox (mail-enabled user).

Note: Do not use the script ‘as is’ against any other mailbox type (shared, resource, etc)!

This script will set the following attributes to NULL:

  • homeMDB = NULL
  • homeMTA = NULL
  • msExchHomeServerName = NULL

and then sets the following attributes:

  • msExchVersion = “44220983382016” (this is relevant for mailboxes previously hosted on Exchange 2003)
  • msExchRecipientDisplayType = “-2147483642” (SyncedMailboxUser)
  • msExchRecipientTypeDetails = “2147483648” (RemoteUserMailbox)
  • msExchRemoteRecipientType = “4” (migrated)
  • targetAddress = [email protected]

To run the script, save as a PowerShell ps1 file. The samAccountName of the affected mailbox is a required input as in the below example:

.\Complete_MailUser_Conversion -samAccountName smithj

[sourcecode language=”powershell” gutter=”false”]
# Global Variables & Constants

Import-Module activedirectory

$targetDomain = "*@contoso.mail.onmicrosoft.com" #Update to match your own
$ProxyAddresses = (Get-AdUser $samAccountName -properties *).ProxyAddresses
$UPN = (Get-AdUser $samAccountName -properties *).UserPrincipalName
$target = $proxyaddresses -like $targetDomain -replace ‘smtp:’,’SMTP:’

# Script START
if ($target -gt 0) {

Get-ADUser -Filter ‘UserPrincipalName -eq $upn’ | `
Set-ADUser -Clear homeMDB, homeMTA, msExchHomeServerName -Replace @{ msExchVersion="44220983382016";msExchRecipientDisplayType="-2147483642";msExchRecipientTypeDetails="2147483648";msExchRemoteRecipientType="4";targetAddress=$target }
# Script END

, ,

Join the conversation! 4 Comments

  1. Thanks for sharing! This article played a key role in addressing some discrepancies with migrated objects that did not complete for some unknown reason.

    You’re a hero!

  2. Excellent solution. Thanks

  3. Maybe credit the guy that ACTUALLY wrote this and the script??

  4. I am currently having the same problem. We are currently migration from Exchange server 2010 to Office 365. I will like to know if the powershell command is to be run on-premise (Active Directory/Exchange Server) or on exchange online powershell.


Comments are closed.