How to use PowerShell to migrate mailboxes from one database to another in Exchange 2013

Migrating Exchange mailboxes between databases is not your every-day task, and administrators can therefore find themselves spending an inordinate amount of time troubleshooting or re-distributing mailboxes across the databases. In this article, we will show you how to move mailboxes from one database to another in Exchange 2013 using the Exchange PowerShell. Following these steps should hopefully allow you to spend less time and make fewer mistakes when it comes to doing this task yourself.

Step 1 – Get the Mailbox Names

Open the Exchange Management Shell. Determine the names of the databases so that they can be simply copied to the move mailbox command.

Get-MailboxDatabase

Get-Mailbox -Database Mailbox Database 2242144626 -ResultSize Unlimited | New-MoveRequest -TargetDatabase Mailbox Database 1063240071

Step 2 – Move the User Mailboxes

After you run the New Move Request command, the mailboxes will be queued. This may take some time depending on the number of mailboxes involved. 

Step 3 – Check the Progress of the User Mailbox Migration

The following command must be run to check the progress of the migration. The below image shows a completed mailbox move. The last column shows the percentage of completion, which in this case is 100.

Get-MoveRequestStatistics -MoveRequestQueue Mailbox Database 10632440071

Step 4 – Remove the Mailbox Move Request

After the mailbox move request is complete and all the mailboxes have been moved, run the following command to remove the mailbox move requests.

Get-MoveRequest | where {$_.status -eq “Completed”} | Remove-MoveRequest

Step 5 – Arbitration and Archive Mailboxes

Even after the user mailboxes have been migrated, there may still be Archive and Arbitration mailboxes in your database that you also want to move. Run the following commands to locate these mailboxes in your database:

Get-Mailbox -Database Mailbox Database 2242144626 –Arbitration

Get-Mailbox -Database Mailbox Database 2242144626 –Archive

Running these commands will show the names of the arbitration and archive mailboxes in your database. If there are any such mailboxes, you can run the following commands to move them to the new database:

Get-Mailbox -Database Mailbox Database 2242144626  -Arbitration | New-MoveRequest -TargetDatabase Mailbox Database 1063240071

Get-Mailbox -Database Mailbox Database 2242144626 -Archive | New-MoveRequest -TargetDatabase Mailbox Database 1063240071

To monitor the progress of the mailbox move, use the following command:

Get-MoveRequestStatistics -MoveRequestQueue Mailbox Database 10632440071

After all the mailboxes have been moved, you can use the following command to clean up the mailbox move requests.

Get-MoveRequest | where {$_.status -eq “Completed”} | Remove-MoveRequest

You can then use the Get-MoveRequest command to ensure that all move requests have been cleared before you run a new one. 

Conclusion
Before you attempt to move mailboxes from one database to another in Exchange 2013 it would be wise to go over the steps laid out in this article in detail. Without an in-depth knowledge of the process, the migration can tend to be time consuming. If you’re looking for an altogether quicker and simpler method, Migrator for Exchange has proven to be both a powerful and cost-effective way of migrating mailboxes in Exchange 2013.