Wednesday, April 5, 2017

Cross Forest Exchange Migration

AD PowerShell Cross Forest Migration


MyLocalDomain
$LocalCredentials = Get-Credential
TheirRemoteDomain
$RemoteCredentials = Get-Credential

Mydomain\Myadmin
Theirdomain\Theiradmin

Prepare Before Migration:
.\Prepare-MoveRequest.ps1 -Identity remoteuser@theirdomain.net -RemoteForestDomainController theirdomaincontrollerfqdn -RemoteForestCredential $RemoteCredentials -UseLocalObject -OverwriteLocalObject -TargetMailUserOU "OU=mydomain,DC=net"

Migrate:
New-MoveRequest -Identity remoteuser@theirdomain.net -Remote -TargetDatabase "MDB01" -RemoteGlobalCatalog "theirdomaincontrollerfqdn" -RemoteCredential $RemoteCredentials -TargetDeliveryDomain "mydomain.net" -RemoteHostName "theirdomain.net"

With Bad Items & Suspend:
New-MoveRequest -Identity remoteuser@theirdomain.net -Remote -TargetDatabase "MDB01" -RemoteGlobalCatalog "theirdomaincontrollerfqdn" -RemoteCredential $RemoteCredentials -BadItemLimit 500 -AcceptLargeDataLoss -LargeItemLimit 100 -TargetDeliveryDomain "mydomain.net" -RemoteHostName "theirdomain.net" -SuspendWhenReadyToComplete

Bulk Migration:

Import File:
$InputFile = "C:\Batch01.csv"

Prepare Migration:
Import-Csv $InputFile | Foreach{.\Prepare-MoveRequest.ps1 -Identity $_.PrimarySmtpAddress -RemoteForestDomainController "theirdomaincontrollerfqdn" -RemoteForestCredential $RemoteCredentials -UseLocalObject -OverwriteLocalObject -TargetMailUserOU "Mydomain,DC=net"}

Migrate:
Import-Csv $InputFile | Foreach{Update-Recipient –Identity $_.PrimarySmtpAddress}

Bad Items & Suspend:
Import-Csv $InputFile | foreach {New-MoveRequest -Identity $_.PrimarySMTPAddress -Remote -TargetDatabase MDB01 -RemoteGlobalCatalog "theirdomaincontrollerfqdn" -RemoteCredential $RemoteCredentials -BadItemLimit 200 -AcceptLargeDataLoss -LargeItemLimit 100 -TargetDeliveryDomain "mydomain.net" -RemoteHostName "mail.theirdomain.net" -SuspendWhenReadyToComplete}

Check Status:
Get-MoveRequestStatistics -Identity username@theirdomain.net
Resume after 95% completion:
Resume-MoveRequest -Identity "username@theirdomain.net