The quick overview on the purpose of this bit of code, is: When you migrate mail from one Exchange mail system to another (say via PST files), users will find that the migrated email results in bounce notices like the below:
# 550 5.1.1 RESOLVER.ADR.ExRecipNotFound; Not found
The source of the issue is that Exchange historically stored it's native addressing in X500 format (reflected in the IMCEA... string above). Eventually, Microsoft formalized that structure as the 'modern' LegacyExchangeDN ("LEDN") mailbox property.
Unfortunately that distiguished-name-style string is organization-specific. No other org on the planet will be running objects with those address.
Well, that is, unless you splice in the old org's LEDN value as a new X500 address in the migrated mailboxes' EmailAddresses list.
And that's where this script/process comes in: It takes a dump of the old org's LEDN values (and WindowsEmailAddress strings, for matching of the objects between orgs), and adds a new matching address into the destination org's mailboxes.
After you do that, when a user uses Outlook to reply-to an old migrated email moved to the new mail org, there's an existing address in the Global Address Book that corresponds to the original LEDN. And that 'patches' the issue and lets Exchange resolve the old recipient to the current mail recipient, to get the mail to delivery without issues.
Notes and instructions are in the help in the script: Pretty simple stuff. Commonly available conceptual code. The only real adds I make to the process are:
- I run more error checking and validation
- I dump output details.
- And this also supports a -whatif param to let you run test passes.
- Oh, and it runs natively in Exchange Mgmt Shell - most approaches use the AD powershell module's set-aduser command to do the update. I don't mind AD, but using Exchange gives me more detail and better control.
Here's the code:
And the current revision can always be found at Github: append-x500LEDN-ToMbxEmailAddressess.ps1