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. 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 e-mail is john.doe@alitajran.com. We want to move the mailbox of the user to another database with PowerShell.

Before moving the mailbox to another database, make sure that you have read the article Exchange database best practice »

Get mailbox information with PowerShell

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

[PS] C:\>Get-Mailbox "john.doe@alitajran.com" | Format-List Database


Database : DB01
[PS] C:\>Get-Mailbox "Doe John" | Format-List Database


Database : DB01

The mailbox of the user resides in database DB01.

Move mailbox with PowerShell

Now that we know that the user resides in database DB01, we want to move the mailbox to another database. We will move the mailbox to database DB02. Let’s make use of the New-MoveRequest cmdlet.

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

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

Change the identity, if you want to move the mailbox by the name of the user.

[PS] C:\>New-MoveRequest -Identity "Doe John" -TargetDatabase "DB02"
 
DisplayName StatusDetail        TotalMailboxSize               TotalArchiveSize PercentComplete
----------- ------------        ----------------               ---------------- ---------------
Doe John    WaitingForJobPickup 4.891 GB (5,251,716,383 bytes)                  0

Check mailbox move progress with PowerShell

The mailbox is moving at the moment. Check the status of the move mailbox. Make use of the Get-MoveRequest cmdlet and Get-MoveRequestStatistics cmdlet.

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

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

Messages are being copied. Run the command again.

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

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

When the mailbox is completely moved, you will see that john.doe@alitajran.com is 100% completed.

Verify if the mailbox is moved with PowerShell

Check if the user is moved to the new database DB02.

[PS] C:\>Get-Mailbox "john.doe@alitajran.com" | Format-List Database


Database : DB02

Great, the user is moved to DB02 with success. Will you move another mailbox to Exchange 2010/2013/2016/2019 with PowerShell?

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

Conclusion

In this article, 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 went great. It’s always good to keep these commands by your side if you need to move a mailbox to Exchange 2016 in the future.

If you enjoyed 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 3 Comments

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

    1. Hi Andrejs,

      The New-MoveRequest cmdlet does not have a parameter to send notification emails. But, this is possible if you want to move mailboxes with the New-MigrationBatch cmdlet.

      The Exchange Admin Center (EAC) makes use of the New-MigrationBatch cmdlet and not the New-MoveRequest cmdlet.

      Read more about the difference in the following article: New-MigrationBatch or New-MoveRequest in Exchange

Leave a Reply

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

Back To Top