Offboarding mailboxes back to on-premises Exchange with Office 365

Most companies use the built-in migration feature in the Office 365 Portal for onboarding mailboxes to the cloud. This has been recently upgraded with alot of new features such as batches and migration end-points etc.

However a logical question is, what about migrating mailboxes back to our on-premises Exchange organisation? Creating those end-points can sometimes be difficult. To make life easier I use this simple PowerShell script. Before you can run the script you first have to connect to Remote PowerShell. For that please follow the instructions described here.

$opcred = get-credential domain\domainadmin
Get-Mailbox -Identity username@contoso.com | New-MoveRequest -OutBound -RemoteTargetDatabase ‘Database01’ -RemoteHostName ‘hybrid.contoso.com’ -RemoteCredential $opcred -TargetDeliveryDomain ‘contoso.com’

As you can see we define several parameters. Most of them should make sense to you, however I want to highlight that in a hybrid scenario you must use the database on your hybrid server. The RemoteHostName parameter is your hybrid endpoint.

One thought on “Offboarding mailboxes back to on-premises Exchange with Office 365

  1. Thanks Thomas,
    I have found that I don’t need to specify the database on the hybrid server. In a scenario where we have an on-prem Exchange 2016 Hybrid management server as the hybrid endpoint and Exchange 2010 on-prem mailbox / cas servers with the live databases, it is ok to specify one of the Exchange 2010 databases in the powershell command.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s