Moving mailboxes between Exchange 2010 on-prem & Exchange Online for hybrid environments

Migrating Exchange 2010 mailboxes to and from Exchange Online needs to be performed via PowerShell

Connecting to Exchange Online
$UserCredential = Get-Credential (Enter your O365 Global Admin credentials)
$ONPREMCREDS = Get-Credential (Enter your on-prem credentials domain\username)
Create a persistent connection to O365 

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import commands
Import-PSSession $Session

Moving on-prem mailbox to Exchange Online

New-MoveRequest -Identity “UserAlias” -Remote -RemoteHostName HybridEndpoint.domain.com -TargetDeliveryDomain domain.mail.onmicrosoft.com -RemoteCredential $ONPREMCREDS -BadItemLimit 1000

Moving Exchange Online mailbox to on-prem
new-moverequest -identity UserAlias -OutBound -RemoteTargetDatabase ‘On-premMailboxDatabase’ -RemoteHostName ‘HybridEndpoint.domain.com’ -RemoteCredential $(Get-Credential) TargetDeliveryDomain ‘HybridEndpoint.domain.com

Monitoring move requests
Get-MoveRequest | Get-MoveRequestStatistics
Clearing previous move requests
Get-MoveRequest | Remove-MoveRequest

Disconnect PSSession once finished
Remove-PSSession $Session

Advertisements