Exchange TIP: How to Migrate Mailbox from Exchange Online to Exchange OnPrem
In this quick post, I will go through a quick PowerShell I use to migrate a mailbox from Exchange Online back to Exchange Onprem.
Let’s first start by connecting to Exchange Online PowerShell.
Once connected run the following:
Before we can run the below cmdlets, we need to understand what additional parameters are needed for the MoveRequest.
- Identity: this is the mailbox that we need to move back to onprem
- RemoteTargetDatabase: This is the database on the remote server, your onprem exchange server database.
- RemoteHostName: This is the public FQDN used during your hybrid setup. Example mail.thatlazyadmin.com
- TargetDeliveryDomian: This is your primary smtp domain used.
We will start the process by specifying an account that has admin permissions on Exchange Onprem.
$rmcred = get-credential thatlazyadmin\yoda
Next, we can run the rest of the PSH, which includes the move request.
Get-Mailbox -Identity firstname.lastname@example.org | New-MoveRequest -OutBound -RemoteTargetDatabase ‘DB001’ -RemoteHostName ‘mail.thatlazyadmin.com’ -RemoteCredential $rmcred -TargetDeliveryDomain ‘thatlazyadmin.com’
To view the status of a move request run the following: MoveRequest Statistics which will include the move request percentage so you can get an indication of how far the move is from being completed.
Get-MoveRequest "Journaling O365 Mailbox" |Get-MoveRequestStatistics