Exchange – Move ‘ALL’ Mailboxes From One Database to Another

KB ID 0000864 

Problem

While replacing an Exchange Server on my test network last week, I needed to get all the mailboxes moved across to the new one. Exchange gets upset if you try and delete a mailbox database that has data in it.

Solution

1. Launch the Exchange Management Shell > Firstly lets get the names of my Databases, then I can simply copy and paste them into the move mailbox command.

Get-MailboxDatabase

Get-Mailbox -Database Source Database Name -ResultSize Unlimited | New-MoveRequest -TargetDatabase Target Database Name

Move All Mailboxes to Another Database

2. The Mailbox moves should then be queued, depending on how many there are, this can take some time to complete.

Remove all move requests

3. To check on progress issue the following command;

Get-MoveRequestStatistics -MoveRequestQueue Target Database Name

 

4. When complete you should remove the movement requests like so;

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

Remove all move requests

5. That’s all the ‘user’ mailboxes, but your source database server may have system mailboxes in it. These will be either Arbitration mailboxes, or Archive Mailboxes (or both). I don’t have any archive mailboxes, but I do have Arbitration mailboxes. To find out for your databases, use the following commands;

Get-Mailbox -Database Source Database Name -Arbitration

6. To move Arbitration and Archive mailboxes, use the following commands;

Get-Mailbox -Database Source Database Name -Arbitration | New-MoveRequest -TargetDatabase Target Database Name

Get-Mailbox -Database Source Database Name -Archive | New-MoveRequest -TargetDatabase Target Database Name

Move Arbitration Mailboxes

7. You can monitor progress with the same command you used in step 3, and remove the move requests with the same command you used in step 4.

8. In addition you may also have some Auditlog mailboxes like so;

Get-Mailbox -Database Source Database Name -Auditlog | New-MoveRequest -TargetDatabase Target Database Name

Move Auditlog Mailboxes

9. Also you may have Monitoring Mailboxes, (In the screenshot below you can see I don’t have any archive mailboxes, as the command returns no results)

Get-Mailbox -Database Source Database Name -Monitoring | New-MoveRequest -TargetDatabase Target Database Name

Move Archive and Monitoring Mailboxes

10. When complete remove the move requests;

Get-MoveRequest -MoveStatus Completed | Remove-MoveRequest

emove Archive and Monitoring move requests

11. Finally on Exchange 2013 (and newer) you may also have Public Folder Mailbox(s).

Get-Mailbox -Database Source Database Name -PublicFolder | New-MoveRequest -TargetDatabase Target Database Name

Move Public Folder Mailboxes

Don’t forget to remove any outstanding move requests.

Related Articles, References, Credits, or External Links

NA

Author: Migrated

Share This Post On