Tuesday, 05 June 2012 14:08

Script your Prepare-MoveRequest and New-MoveRequest to ease the cross forest migration process

Written by

I have scripted the Prepare-MoveRequest and New-MoveRequest together to ease the process of cross forest mailbox migration. All you need to provide is the PrimarySMTP address of the user you wish to migrate in the input file. The script itself is self-explanatory.

 This script will only work if you have the target user as mail enabled. If you have not done, please read my previous post about preparing the target forest mail usersfor the migration.

Cross Forest Migration GAL Preparation - Exchange 2007 to 2010

 If you are ready to move, then copy the below script and save it as _PrepareAndMove.ps1

~~~~~~~~

#------------------------------------
#Script for Cross Forest Mailbox Move
#------------------------------------
Write-Host "Enter the Source Domain Migration Admin Credential"
Write-Host "Press any key when ready ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
$InputFile = "C:\Migration\Input\MailEnable.csv" #User list file "MailEnable.csv" saved under the folder "C:\Migration\Input"
$SourceADServer = "dc01.ex2007forest.local" #Source Forest Domain Controller
$RemoteCredentials = Get-Credential #Enter the Source Forest Migration Crendentials

Import-Csv $InputFile |foreach{
&'c:\Program Files\Microsoft\Exchange Server\V14\Scripts\Prepare-MoveRequest.ps1' -Identity $_.PrimarySmtpAddress -RemoteForestDomainController $SourceADServer -RemoteForestCredential $RemoteCredentials -UseLocalObject
}
#------------------------------------
#Call 1 minute time wait function
#------------------------------------
#.\_Wait4OneMinute.ps1 # you will get many time wait functions, use one of them.
# time Wait function ends
#------------------------------------#Initiate MoveRequest Command Section
#------------------------------------
Import-Csv $InputFile |foreach{
New-MoveRequest -Identity $_.PrimarySmtpAddress -RemoteLegacy -RemoteGlobalCatalog $SourceADServer -RemoteCredential $RemoteCredentials -TargetDeliveryDomain email.exhchangedictionary.com
}
#End of Script

~~~~~~~

Create the input file as shown below, and save it on the path mentioned in script.

CrossForest_Move

 This should make your process easier, let me know if you face some issues.

-Praveen

theme by reviewshub