<

Useful Powershell script to resolve the X500 address

Published on
3,297 Points
197 Views
1 Endorsement
Last Modified:
Mohammed Hamada
I am a senior IT consultant for Azure, Telecom, Messaging and collaboration and Infra. I have been in the IT sector since 15 years.
In migration, Powershell can be a very crucial tool to achieve success and finalize projects within deadline or even fix issues.

X500 or Legacy Exchange DN Attribute can cause lots of issue during the migration

During the time of working with Exchange Migration projects, you might face lots of issues with users not being able to send an email to their migrated colleagues due to some issues with contacts which was caused by the Legacy Exchange DN not being migrated with the user or lost due to some wrong deletion.


Once users try to send an email to that particular user with the missing Legacy Exchange DN. The receiving Exchange server will result in an error and send it to the user as NDR message explaining to them that the error is due to not finding the particular address.



The solution to this particular problem is very simple especially if it’s a couple of users however to resolve the address you’ll need to google and understand the language that Exchange server users to match the originally used address in the missing user’s attributes.


The below script would work accordingly with whatever situation that faced me and it became very handy to me.

How to use:


1- Copy the script to a notepad and save as convert.ps1 on Desktop

2- Run the script and try to type in PowerShell convert-X500 then hit enter.

3- Copy and paste the address you got from the error message above.



Once you copy and paste hit enter and you’ll get the final result



Note: Make sure you remove the @domain.local in the end


Function Convert-X500{ # Define the Legacy Exchange DN here
Write-Host ""Enter your X500 Address here..."" -ForegroundColor Green -BackgroundColor Black
 $X500Source  = read-host 


 # Converts the various strings to the proper syntax
 $X500 = $X500Source.Replace("_", "/")
 $X500 = $X500.Replace("+20", " ")
 $X500 = $X500.Replace(“IMCEAEX-", "")
 $X500 = $X500.Replace("+28", "(")
$X500 = $X500.Replace("+29", ")")
 $X500 = $X500.Replace("+2E", ".")
 $X500 = $X500.Replace("+5F", "_")
 $X500 = $X500.Replace("@YourDC.localHere", "")

Write-Host X500:$X500}


Hope you find this helpful

1
Comment
0 Comments

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Join & Write a Comment

This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month