Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstreefkerk/c2bca3f4c9c0a3d4b7c1769ed4e3fd15 to your computer and use it in GitHub Desktop.
Save dstreefkerk/c2bca3f4c9c0a3d4b7c1769ed4e3fd15 to your computer and use it in GitHub Desktop.
PowerShell function to create an X500 proxy address from a IMCEAEX NDR
Function Create-X500ProxyAddressFromLegacyExchangeDN($Address) {
# As per https://support.microsoft.com/en-au/help/2807779/imceaex-non-delivery-report-when-you-send-email-messages-to-an-interna
$Address = $Address.Replace('_','/') # Replace any underscore character (_) with a slash character (/)
$Address = $Address.Replace('+20',' ') # Replace "+20" with a blank space
$Address = $Address.Replace('+28','(') # Replace "+28" with an opening parenthesis character
$Address = $Address.Replace('+29',')') # Replace "+29" with a closing parenthesis character.
$Address = $Address.Replace('IMCEAEX-','') # Delete the "IMCEAEX-" string
$Address = $Address.Split('@')[0] # Delete the "@mgd.domain.com" string
$Address = "X500:$Address" # Add "X500:" at the beginning
$Address
}
@dstreefkerk
Copy link
Author

And yes, I've seen this one: http://www.o-xchange.com/2014/07/script-for-converting-bounce-back.html

I prefer this more verbose method, as it's clearer for someone to pick up on what the script's doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment