Skip to 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?

Why moving all mailboxes

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

Note: Do you like to know which mailboxes are taking up the most space? Read the article Get mailbox size of all users in Exchange with PowerShell.

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. Next, run the Get-MailboxDatabase cmdlet, including the -IncludePreExchange parameter 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. Therefore, we will 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. Instead, you can do it faster. The following cmdlets apply to Exchange Server 2010/2013/2016/2019.

Important: Before you move the mailboxes, run the Set-ADServerSettings cmdlet, including the -ViewEntireForest parameter. This will let you view the objects in the entire forest.

[PS] C:\>Set-ADServerSettings -ViewEntireForest $true

Do you want to move the mailbox but suspend the move request before it reaches the status of CompletionInProgress, so you can manually complete it? An excellent way is to use the -SuspendWhenReadyToComplete switch in every command.

Mailbox

[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

Mailbox Plan

Mailbox plan is not relevant for on-premises Exchange environments. It’s only available in cloud-based service.

A mailbox plan is a template that automatically configures mailbox properties in Exchange Online. Mailbox plans correspond to Office 365 license types. When you assign a license to a new user, the corresponding mailbox plan is used to configure the settings on the new mailbox that’s created. If you change the license that’s assigned to an existing user, the settings in the mailbox plan that’s associated with the new license are applied to the user’s existing mailbox.

Archive mailbox

[PS] C:\>Get-Mailbox -ResultSize Unlimited | Where {$_.ArchiveDatabase -like "DB01"} | New-MoveRequest -ArchiveTargetDatabase "DB02"

Public folder mailbox

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

Arbitration mailbox

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

Audit Log mailbox

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

Monitoring mailbox

The best practice is to not move the monitoring mailboxes between mailbox databases. In my experience, it’s best to find the monitoring mailbox and disable them. If you don’t, you get a repeated warning in the event viewer logs after deleting the mailbox database. Also, the health mailboxes will be in a corrupt state. Read the article, check Exchange health mailboxes.

[PS] C:\>Get-Mailbox -Database "DB01" -Monitoring | Disable-Mailbox -Confirm:$false

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. Run the Get-MoveRequestStatistics cmdlet 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 after the move finishes. This will give you a clear view the next time you move mailboxes. If you want to remove all move requests, run the second command.

[PS] C:\>Get-MoveRequest -MoveStatus Completed -ResultSize Unlimited | Remove-MoveRequest -Confirm:$false

[PS] C:\>Get-MoveRequest -ResultSize Unlimited | Remove-MoveRequest -Confirm:$false

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

Conclusion

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 mailbox move request in Exchange Server. 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 12 Comments

  1. Hello,
    thanks for the Infos.
    can the new Database exist on another Exchange Server, in the same domain and the same Exchange Version?
    Is there something to consider here?

      1. thanks for Reply.
        another Question please, should we deinstall the old/Source Exchnage after the Migration?

  2. Hello Ali, have you ever find a case with “invalid culture identifier” when try to migrate mailbox to another db?

      1. Thanks for confirming! Would there be any other types of mailboxes that would need to be migrated?

        We currently have 1 single database where all the user mailboxes have been migrated to Exchange Online. Would love to free up 500+ gigs of space it’s taking up.

        So basically I’m looking to move EVERYTHING to a new DB 🙂

        1. Creating a new mailbox database is the correct approach to free up space.

          You have to move other mailboxes too. I updated the article.

          Everything is okay if you can dismount the mailbox database and remove it. If not, you will get an error that the database contains one or more mailboxes.

          Also, I recommend you enable circular logging on the new mailbox database because all the mailboxes are in Exchange Online.

          I explained the above and more in the following article: Keep last Exchange Server in organization.

  3. I have tried following your instructions and all moves got Stalled. I was able to somewhat cancel the move and now status on all mailboxes that I was trying to move is WaitingForJobPickup. How do I clear it up?

    1. Hi Arnold,

      There will be a short downtime (disconnect) at the end of the mailbox move.

      The user will get a notification in Outlook (only if Outlook is open) when the mailbox finishes moving to the other database. So it’s good to let the user know that they will get a popup in Outlook and then need to restart their Outlook.

      Another option is to move the mailbox after working hours, so the users do not get that message in Outlook, and they don’t even know that the mailbox moved to another database.

  4. Hola Ali, te agradezco mucho los tips que haz publicado en tu página realmente son muy útiles y de gran ayuda para poder optimizar Exchange 2013, el cual estoy aprendiendo y en la repartición el cual trabajo no nos han capacitado y realmente es todo buscar en las redes y ver que sirve y que no. Desde ya muchisimas gracias, saludos desde Argentina.

Leave a Reply

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