skip to Main Content

Move mailbox to another database with PowerShell

You can move a mailbox in Exchange 2010/2013/2016/2019 to another database with PowerShell. However, there is another way than with PowerShell. That is with Exchange Control Panel (ECP). I recommend doing it with Exchange Management Shell (EMS). The ECP is not always fast in refreshing the results. In this article, we will move a mailbox to another database with PowerShell.

Information

We have a user called John Doe, and his email is john.doe@exoip.com. We want to move the user mailbox to another database with PowerShell.

Note: Before moving the mailbox to another database, ensure that you have read the article Exchange database best practices.

Get mailbox information with PowerShell

Let’s first check which database the user is currently on. Run Exchange Management Shell as administrator and run the Get-Mailbox cmdlet. You can search by user email address or the name of the user.

The primary mailbox and archive mailbox locations are in database DB01.

[PS] C:\>Get-Mailbox "john.doe@exoip.com" | Format-Table Name,PrimarySmtpAddress,Database,ArchiveDatabase

Name     PrimarySmtpAddress Database ArchiveDatabase
----     ------------------ -------- ---------------
John Doe John.Doe@exoip.com DB01     DB01           
[PS] C:\>Get-Mailbox "John Doe" | Format-Table Format-Table Name,PrimarySmtpAddress,Database,ArchiveDatabase

Name     PrimarySmtpAddress Database ArchiveDatabase
----     ------------------ -------- ---------------
John Doe John.Doe@exoip.com  DB01     DB01          

Now that we know that the primary mailbox and archive mailbox are in DB01, let’s look at the next step on how to move the mailboxes.

Move primary mailbox and archive mailbox with PowerShell

Move the primary mailbox and archive mailbox to another database. We will move the primary mailbox and archive mailbox to database DB02.

Let’s run the New-MoveRequest cmdlet.

[PS] C:\>New-MoveRequest "john.doe@exoip.com" -TargetDatabase "DB02"

DisplayName StatusDetail        TotalMailboxSize               TotalArchiveSize         PercentComplete
----------- ------------        ----------------               ----------------         ---------------
John Doe    WaitingForJobPickup 4.891 GB (5,251,716,383 bytes) 810.9 KB (830,394 bytes) 0              

Another option is to move the primary mailbox and archive mailbox to different mailbox databases. Let’s move the primary mailbox to DB02 and the archive mailbox to DB03.

[PS] C:\>New-MoveRequest "john.doe@exoip.com" -TargetDatabase "DB02" -ArchiveTargetDatabase "DB03"

DisplayName StatusDetail        TotalMailboxSize               TotalArchiveSize         PercentComplete
----------- ------------        ----------------               ----------------         ---------------
John Doe    WaitingForJobPickup 4.891 GB (5,251,716,383 bytes) 810.9 KB (830,394 bytes) 0              

Move primary mailbox only with PowerShell

Suppose we want to move the primary mailbox only. We have to add the -PrimaryOnly parameter to the command.

[PS] C:\>New-MoveRequest "john.doe@exoip.com" -TargetDatabase "DB02" -PrimaryOnly

DisplayName StatusDetail        TotalMailboxSize               TotalArchiveSize PercentComplete
----------- ------------        ----------------               ---------------- ---------------
John Doe    WaitingForJobPickup 4.891 GB (5,251,716,383 bytes)                  0              

Move archive mailbox only with PowerShell

If we want to move the archive mailbox only, we need to add the -ArchiveTargetDatabase and the -ArchiveOnly parameters to the command.

[PS] C:\>New-MoveRequest "john.doe@exoip.com" -ArchiveTargetDatabase "DB02" -ArchiveOnly

DisplayName StatusDetail        TotalMailboxSize TotalArchiveSize         PercentComplete
----------- ------------        ---------------- ----------------         ---------------
John Doe    WaitingForJobPickup 0 B (0 bytes)    812.4 KB (831,851 bytes) 0              

Check mailbox move progress with PowerShell

Run the Get-MoveRequest cmdlet and Get-MoveRequestStatistics cmdlet to check the mailbox move status.

[PS] C:\>Get-MoveRequest | Get-MoveRequestStatistics

DisplayName StatusDetail    TotalMailboxSize               TotalArchiveSize         PercentComplete
----------- ------------    ----------------               ----------------         ---------------
John Doe    CopyingMessages 4.891 GB (5,251,716,383 bytes) 812.4 KB (831,851 bytes) 84             

Messages are being copied. Run the command again.

[PS] C:\>Get-MoveRequest | Get-MoveRequestStatistics

DisplayName StatusDetail TotalMailboxSize               TotalArchiveSize         PercentComplete
----------- ------------ ----------------               ----------------         ---------------
John Doe    Completed    4.891 GB (5,251,716,383 bytes) 812.4 KB (831,851 bytes) 100            

When the mailbox completes, you will see that john.doe@exoip.com is 100% completed.

Verify mailbox move completion with PowerShell

Check if the user mailbox and archive mailbox are moved to the new database.

[PS] C:\>Get-Mailbox "john.doe@exoip.com" | Format-Table Name,PrimarySmtpAddress,Database,ArchiveDatabase

Name     PrimarySmtpAddress Database ArchiveDatabase
----     ------------------ -------- ---------------
John Doe John.Doe@exoip.com DB02     DB03           

Both the mailboxes have been successfully moved. Will you move the mailbox to Exchange 2010/2013/2016/2019 with PowerShell?

Read more: Move all mailboxes from one database to another »

Conclusion

You learned how to move a mailbox in Exchange 2010/2013/2016/2019 to another database with PowerShell. I hope you can make good use of these commands and that a mailbox migration to another database will go great. It’s always good to keep these commands by your side if you need to move a mailbox to another database in the future.

Did you enjoy this article? You may also like Cleanup logs Exchange 2013/2016/2019. 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 4 Comments

  1. Thanks Ali

    for this article helping to understand move requests. I was wondering why there is no copy request or something else to copy the content of a mailbox to another mailbox.

    Investing some time finding a cmdlet I wasnt successful. What is the best why to copy data from a mailbox to another mailbox? Simple export/import to a PST cant be the only way, I guess. Any other ideas?

    Cheers
    Michael

  2. Hi,
    Thanks for this manual. Would be great also to add parameter for sending email, when move is initiated and done. Doing this via ECP provides this feature.

Leave a Reply

Your email address will not be published.