Tuesday, 20 March 2012 08:34

Cross Forest Migration GAL Preparation - Exchange 2007 to 2010

Written by

One of the most important stage of a Cross forest exchange migration is to have the Global Address List (GAL) availability to the end users in target forest including the required LegacyExchangeDN as x500 address. If we don’t add the legacyExchangeDN as x500 to the target forest, there are many chances of generating NDRs from user who sends email using outlook clients. This is due to the cached address list contact with the old information. The below piece of script will help in creating Global Address List (GAL) in the target forest with the LegacyExchangeDN as x500 address thus avoiding/reducing chances for such NDRs.

Note - This is applicable only when your migration approach is different from the normal MS recommended approach (i.e. preparemoverequest -> ADMT-> Mailbox Move).

My scenario was,

  1. Migrate the account fist to target forest
  2. Convert(connect) all mailboxes as Linked mailboxes, and keep the exchange server in source forest. I already have posted a script to automate the linked mailbox migration, see here
  3. Move the mailboxes to target after the completion of converting all mailboxes are linked mailbox. (Resource forest to Account forest mailbox move).

Sometime we will have to migrate the user account first and followed to which the mailboxes. Or, when you are planning to migrate the Linked mailboxes (resource forest) to User mailboxes (account forest). In both the cases, you will be having linked mailboxes as an interim and the account forest will not have a complete GAL.

First of all, export the data required from the resource forest (source forest). The csv should at least include the below attributes of the mailbox from the source forest,
SamAccountName,Alias,LegacyExchangeDN,PrimarySmtpAddress,
You may export the data using the below command(from the old exchange server org),
Get-Mailbox |select samaccountname,alias,LegacyExchangeDN,PrimarySmtpAddress | Export-Csv c:\MailEnable.csv

Once you have the data delete the first line “#TYPE System.Management.Automation.PSCustomObject” of the output CSV and then copy it to the C:\ drive of new exchange org server. Copy the below script and save it on new Exchange server as _MailEnableScript.ps1 file (preferably under C:\Scripts).

In case of a cross forest migration  you will have intermediate routing between both the exchange organizations until the completion of migration. So, the mail enabled user in new exchange forest will have the target address as primary SMTP of existing source organization for the interim email flow.

###########################################
#Mail Enable Target User with X500 Address
#Save the input file in C:\ root with the name MailEnable.csv
###########################################
Import-Csv C:\MailEnable.csv |foreach{
Enable-MailUser -Identity $_.SamAccountName -Alias $_.Alias -ExternalEmailAddress $_.PrimarySmtpAddress
#Adding the LegacyExchangeDN as X500 address in target organization
$ProxyAddresses = (Get-MailUser $_.Alias).EmailAddresses
$SourceX500 = $_.LegacyExchangeDN
$ProxyAddresses += [Microsoft.Exchange.Data.CustomProxyAddress]("X500:$SourceX500")
Set-MailUser -Identity $_.Alias -EmailAddresses $ProxyAddresses # Updating the email address list of mail enabled user in new exchange org with X500 address.
$smtpAddress=$_.Alias+"@email.contoso.com" # storing the additional smtp email address variable
Set-MailUser -Identity $_.Alias -EmailAddresses @{Add=$smtpAddress} #Adding the additional email address to mail user email address.
}

The additional smtp address will be used for the target address calculation after the mailbox move. Because the old exchange organization need a target address once the mailbox is moved and the source account is converted as mail enabled user(read New-MoveRequest for more details about the cross forest move).

Please read cross forest migration articles(http://blogs.technet.com/b/exchange/archive/2010/08/10/3410619.aspx) to understand the scenario better, and make use of the above simple script to populate the GAL required.

Let me know your comments..

-Praveen

theme by reviewshub