Home » Posts tagged 'x500'

Tag Archives: x500

Powershell Scripts to Export and Import Legacy Exchange X500 addresses

When migrating across AD forests or even performing an offline exchange migration the most over looked process is migrating the user’s legacy X500 address. The reason this is so important is because local email is delivered using the x500 address rather than the SMTP address normally associated with internet email. When you move the user from one unrelated exchange to another the X500 address is not migrated. This means that when users attempt to send an email to a previous contact in their name cache they will receive a bounce back and failed delivery. In order to prevent this situation occurring you can use Powershell to export the legacy X500 address to CSV and then import this into the new AD user object. If you do not have access to Powershell in the legacy domain you can use CSVDE to achieve the same objective.

Export the Legacy X500 Address

Powershell

Get-ADUser -SearchBase “OU=legacyusers,DC=domain,DC=local” -Filter * -Properties SamAccountName,legacyExchangeDN | Select-Object SamAccountName,legacyExchangeDN | Export-CSV C:\UserExport.csv -NoTypeInformation

CSVDE

CSVDE -s <domain controller FQDN> -d “OU=legacyusers,DC=domain,DC=local” -p SubTree -l SamAccountName,legacyExchangeDN -r objectClass=user -f C:\UserExport.csv

Importing the Legacy Exchange X500 Address to New Domain

On a domain controller or a machine with Active Directory Powershell module installed, copy the UserExport.csv to the root of the C:\ drive

Create a Powershell Script file called legacyusers.ps1. In this file type the following code

Import-Module ActiveDirectory

$Input = Import-CSV C:\UserExport.csv

ForEach ($ADUser in $Input){

if ($ADUser.legacyExchangeDN){

Set-ADUser -Identity $ADUser.SamAccountName -add @{proxyAddresses=”X500:$($ADUser.legacyExchangeDN)”}

}

}

Save the file and execute on the domain controller. You can check this has worked by opening an affected AD user object in the new domain and viewing the Attribute proxyAddresses to ensure that this has been added successfully.

%d bloggers like this: