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.
After not needing to migrate any mailboxes for a while, we now need to bring one back on-prem to correct some AD attribute issues. When I try to run the commands as outlined above, I’m getting the following error:
Write-ErrorMessage : |Microsoft.Exchange.MailboxReplicationService.MRSRemoteTransientException|The call to
‘https://XXXXXXXX.XXXXXXXX.com/EWS/mrsproxy.svc’ failed. Error details: The HTTP request was forbidden with client
authentication scheme ‘Negotiate’. –> The remote server returned an error: (403) Forbidden..
Any thoughts on how to begin troubleshooting?
Hello,
Do you know if we can move mailboxes whithout using hybrid environment ?
What is the name of this migration?
Best regards
mors
Hello, I have error: Cannot find a recipient that has mailbox GUID
Follow the article Cannot find a recipient that has mailbox GUID. After that, you can move the mailbox from Exchange Online to on-premises.
Thank you very much, you are the best!
I get this error:
Cannot find a recipient that has mailbox GUID ‘3932c631-74bf-47ce-b481-52839a5213eb’.
The mailbox I try to move was created in the cloud.
Follow the article Cannot find a recipient that has mailbox GUID. After that, you can move the mailbox from Exchange Online to on-premises.
What if I want to move the mailbox which is created on cloud to on-premise?
This article shows you how to move the mailbox in the cloud to on-premises.
Oh ok.
I thought this article is only limited to the scenario On-prem —> Cloud —> On-prem
Thanks.
Keep up the good work
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).
I’m going through this right now and your command worked to get the move requests going, however I still have 5 that are almost always a status of StalledDueToTargetProcessor.
Also, the amount of data that is reporting synced already in EAC is bigger than the mailbox size. How is that possible?