skip to Main Content

Move all mailboxes from one database to another

Sometimes you have to move all mailboxes from one database to another database in Exchange Server. The new target database can be an existing or a new mailbox database. What is the best way to do it? In this article, you will learn how to move all mailboxes from one database to another. Did we tell you that it’s just one single cmdlet to run?

Information about moving all mailboxes

Some examples why you like to move all mailboxes from one mailbox database to another mailbox database:

Find the mounted mailbox databases

We already know the source and target mailbox databases. If you don’t have the names of the mailboxes databases, check which databases are mounted in Exchange Server. Run Exchange Management Shell as administrator. Add the -IncludePreExchange switch if you like to get the mailbox database in previous Exchange versions.

[PS] C:\>Get-MailboxDatabase -IncludePreExchange -Status | Sort Name | Format-Table Name, Server, Mounted

Name Server    Mounted
---- ------    -------
DB01 EX01-2016    True
DB02 EX01-2016    True

We can see that we have two mailbox databases. We are going to move the mailboxes from the source mailbox database DB01 to the target mailbox database DB02.

Move all mailboxes from one database to another database with PowerShell

You don’t have to create an export of mailboxes to CSV and then create a move request to move the mailboxes. You can do it faster. The following cmdlet applies to Exchange Server 2010/2013/2016/2019.

[PS] C:\>Get-Mailbox -Database "DB01" -ResultSize Unlimited | New-MoveRequest -TargetDatabase "DB02"

DisplayName       StatusDetail        TotalMailboxSize         TotalArchiveSize PercentComplete
-----------       ------------        ----------------         ---------------- ---------------
Administrator     WaitingForJobPickup 694.2 KB (710,903 bytes)                  0
Christopher Payne WaitingForJobPickup 805.7 KB (825,070 bytes)                  0
Mary Walsh        WaitingForJobPickup 53.4 KB (54,682 bytes)                    0
Benetiz Anees     WaitingForJobPickup 411.4 KB (421,233 bytes)                  0
Larson Tevin      WaitingForJobPickup 40.93 KB (41,913 bytes)                   0
Jake Cornish      WaitingForJobPickup 40.93 KB (41,913 bytes)                   0

In the next step, we will check if the mailbox moves finished.

Check move request to another database

Have a look at the progress of the mailbox moves. Make use of the Get-MoveRequestStatistics to check the move request.

[PS] C:\>Get-MoveRequestStatistics -MoveRequestQueue "DB02" | Sort DisplayName

DisplayName              StatusDetail TotalMailboxSize         TotalArchiveSize PercentComplete
-----------              ------------ ----------------         ---------------- ---------------
Administrator            Completed    694.2 KB (710,903 bytes)                  100
Ali Tajran               Completed    418.1 KB (428,159 bytes)                  100
Amanda Morgan            Completed    728.2 KB (745,692 bytes)                  100
Anna Welch               Completed    60.56 KB (62,017 bytes)                   100
Benetiz Anees            Completed    411.4 KB (421,233 bytes)                  100
Boris Campbell           Completed    427.9 KB (438,136 bytes)                  100

Remove completed move request

Remove completed move requests in Exchange when finished. This will give you a clear view the next time you are moving mailboxes.

[PS] C:\>Get-MoveRequest -MoveStatus Completed | Remove-MoveRequest

Confirm
Are you sure you want to perform this action?
Removing completed move request "Administrator".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"): A

Now that we moved the mailboxes, we can remove the source mailbox database DB01.

Conclusion

In this article, you learned how to move all mailboxes from one database to another database in Exchange Server. First, get all the mailbox databases that are created in Exchange Server. Write down which mailbox database is the source and which is the target. Run the cmdlet, as shown in the article, to move all mailboxes from one database to another. Check the mailbox move request status, and when it’s completed, clean the completed move requests.

Did you enjoy this article? You may also like Pause all mailbox move request in Exchange. 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 0 Comments

Leave a Reply

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

Back To Top