Skip to content

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.

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

After running the above command, you can get the below errors:

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.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 20 Comments

    1. The -Outbound switch specifies that this mailbox move is a cross-forest move and is being initiated from the source forest.

      You must add it to the command. If you don’t, you are not able to move the mailbox.

  1. Having mailboxes on cloud, makes it easy to have Outlook on the cell phone configured and working. If I migrate from cloud to on-premise, will Outlook on the cell phone work? It is transparent for the user or there’s a need to reconfigure it? If so, what are the steps?

    Thanks

  2. Dear Sir,
    this solution can use migration all users from O365 to on-premise? and then only using exchange on-premise.

  3. I am looking to have EAC spit out the PS commands of every action you do. Mainingly when I am adding batchfiles for migrations. (EXO EAC)

  4. 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?

  5. Hello,

    Do you know if we can move mailboxes whithout using hybrid environment ?
    What is the name of this migration?

    Best regards
    mors

  6. 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.

      1. Oh ok.
        I thought this article is only limited to the scenario On-prem —> Cloud —> On-prem
        Thanks.
        Keep up the good work

  7. Hi,

    Did this way can transfer to another system like mdaemon or kerio email ?

    Or just exchange online to exchange on prem ?

    Thanks,

  8. 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.

      1. 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?

Leave a Reply

Your email address will not be published. Required fields are marked *