Mailboxes are on-premises, and you like to migrate a mailbox or bulk migrate mailboxes to…
Move mailbox from Exchange Online to on-premises
You already did move mailboxes from Exchange on-premises to Exchange Online. What if you want to move a mailbox back to Exchange on-premises? The term is also known as offboarding a mailbox from the cloud. One of the reasons you wish to offboard a mailbox is that applications are not Office 365 ready, and you have to move the mailbox from Exchange Online to on-premises. In this article, we will look at how to move mailbox from Office 365 to on-premises with PowerShell.
Table of contents
How to move mailbox from Exchange Online
To move a mailbox from Exchange Online with PowerShell, follow the steps.
1. Connect to Exchange Online PowerShell
Start PowerShell as administrator and Connect to Exchange Online PowerShell.
PS C:\> Connect-ExchangeOnline
Note: You are not pulling the Exchange Online mailbox to on-premises. In fact, you are pushing the Exchange Online mailbox to on-premises. That’s why you need to connect to Exchange Online and run the commands from Exchange Online PowerShell.
2. Find migration endpoint remote server URL
Get the remote server URL by using the Get-MigrationEndpoint cmdlet. Read more about how to find RemoteHostName URL for mailbox migration. The Hybrid Configuration Wizard created this migration endpoint.
Copy the RemoteServer URL value as you need it in the next part.
PS C:\> Get-MigrationEndpoint | Format-List Identity, RemoteServer
Identity : Hybrid Migration Endpoint - EWS (Default Web Site)
RemoteServer : mail.exoip.com
3. Move mailbox from Exchange Online with PowerShell
Create a new move request to move the primary mailbox and archive mailbox from Exchange Online. Fill in the following details:
- -Identity: Mailbox name or email address
- -RemoteTargetDatabase: Exchange on-premises mailbox database
- -RemoteHostName: The remote server that you copied in the previous step
- -TargetDeliveryDomain: Primary SMTP domain used for the Exchange Online organization mailboxes
- -RemoteCredential: On-premises administrator account with privileges
After running the cmdlet, a credential sign-in request will show up. Fill in the password of the on-premises credentials (RemoteCredential).
PS C:\> Get-Mailbox -Identity "Jordy.Twin@exoip.com" | New-MoveRequest -OutBound -RemoteTargetDatabase "DB01" -RemoteHostName "mail.exoip.com" -TargetDeliveryDomain "exoip.com" -RemoteCredential (Get-Credential exoip\administrator)
DisplayName Status TargetDatabase
----------- ------ --------------
Jordy Twin Queued
4. Move primary mailbox only from Exchange Online with PowerShell
Suppose the primary mailbox and archive mailbox location is in Exchange Online, and you want to move the primary mailbox only.
You must add the -PrimaryOnly and -ArchiveDomain parameters to the command.
Create a new move request to move the primary mailbox only and keep the archive mailbox in the cloud. Fill in the following details:
- -Identity: Mailbox name or email address
- -OutBound: Keep value empty
- -RemoteTargetDatabase: Exchange on-premises mailbox database
- -RemoteHostName: The remote server that you copied in the previous step
- -PrimaryOnly: Keep value empty
- -ArchiveDomain: Primary SMTP domain used for the Exchange Online organization mailboxes
- -TargetDeliveryDomain: Primary SMTP domain used for the Exchange Online organization mailboxes
- -RemoteCredential: On-premises administrator account with privileges
After running the cmdlet, a credential sign-in request will show up. Fill in the password of the on-premises credentials (RemoteCredential).
PS C:\> Get-Mailbox -Identity "Jordy.Twin@exoip.com" | New-MoveRequest -OutBound -RemoteTargetDatabase "DB01" -RemoteHostName "mail.exoip.com" -PrimaryOnly -ArchiveDomain "exoip365.mail.onmicrosoft.com" -TargetDeliveryDomain "exoip.com" -RemoteCredential (Get-Credential exoip\administrator)
DisplayName Status TargetDatabase
----------- ------ --------------
Jordy Twin Queued
5. Get mailbox move status
Get the status of the mailbox move request by using the Get-MoveRequest cmdlet.
PS C:\> Get-MoveRequest -Identity "Jordy.Twin@exoip.com" | Get-MoveRequestStatistics | ft DisplayName,StatusDetail,TotalMailboxSize,TotalArchiveSize,PercentComplete
DisplayName StatusDetail TotalMailboxSize TotalArchiveSize PercentComplete
----------- ------------ ---------------- ---------------- ---------------
Jordy Twin Completed 231.6 MB (242,877,775 bytes) 0 B (0 bytes) 100
The mailbox will complete.
If that is not the case and you can’t complete the mailbox move request, you can suspend and resume the move request. It helps in most situations when you get a failed status. For example, the status detail TransientFailure.
Did this article help you to offboard the mailbox from Exchange Online to Exchange on-premises with PowerShell? I hope it did.
Read more: New-MigrationBatch or New-MoveRequest in Exchange »
Conclusion
You learned how to move a mailbox from Exchange Online to on-premises. Connect to Exchange Online PowerShell and run the cmdlet as shown in the article. Keep an eye out if the mailbox move from Exchange Online successfully completed.
Did you enjoy this article? You may also like Move mailbox to Exchange Online with PowerShell. Don’t forget to follow us and share this article.
Hi,
Did this way can transfer to another system like mdaemon or kerio email ?
Or just exchange online to exchange on prem ?
Thanks,
The steps in the article are only for moving mailboxes from Exchange Online to Exchange on-premises.
Hello,
I want to move my user in Office 365 On-prem, but I want my archive online. I added -PrimaryOnly to the command. The command did not work. How should I edit my command?
Best regards.
I updated the article and added the command to move the primary mailbox only and keep the archive mailbox in the cloud (Exchange Online).