There is no primary SMTP address

Just a few more things I've noticed on the cross-organization mailbox move function in Exchange 2007. On some recent occasions, we've been running the move-mailbox cmdlet with the -AllowMerge switch to copy a mailbox from the source forest/organization to the target. After running the cmdlet, we receive the following warning:


Although the mailbox was moved to the target Microsoft Exchange server, an error occurred while the policies were being applied. Proxy address policies, Unified Messaging settings, managed content settings, and Exchange ActiveSync settings may not be set correctly. There is no primary SMTP address.


The "no primary SMTP address" seems to be the big clue as to what is going wrong here with our procedures. After some digging, this is what we discovered and currently believe is the cause of the problem. When the user is created in the target organization, we deliberately set the –EmailAddressPolicyEnabled:$false parameter on the set-mailbox cmdlet. This is the same thing as un-checking the GUI checkbox "Automatically update email addresses based on email address policy."


The target mailbox is given a primary SMTP address, but when we merge the two mailboxes, it appears that Exchange clears the primary address and then looks to the EAP to reset the primary address based on whatever policy the now migrated user falls under. If the user doesn't have a policy, then Exchange simply does nothing, but is kind enough to warn us.


I tested this theory with two accounts, one of which set EmailAddressPolicyEnabled to $true and one to $false. The results were exactly as I expected. The $true account moved across the organization without incident; the $false account experienced the same problem.


So, what do you do if you need to have that check box cleared, but still need to merge mailboxes? The current work-around is to run the set-mailbox cmdlet with the –PrimarySMTPAddress parameter specifying which of the addresses should remain primary. It's important, however that you use the above parameter and not try to reset the mailbox using the –EmailAddresses parameter, as this will overwrite all existing addresses, including those legacy addresses that were just brought over from the source environment.