Move mailboxes (in bulk) or one by one to another database in Exchange 2010/2013/2016

M AEE Solution Guide - Service Manager
CERTIFIED EXPERT
Most Valuable Expert2017 and 2020.
O365, Exchange Server,Windows Server, Active Directory, Virtualization, Teams and Email Migration Expert.
Published:
Updated:
A method of moving multiple mailboxes (in bulk) to another database in an Exchange 2010/2013/2016 environment...

There are often cases where administrators may need to merge two mailbox databases to one, or move all mailboxes to other mailboxdatabase or move mailboxes after installing new version of Exchange.


Questions about this process have been frequently popping up at Experts Exchange of late, so I've decided to write an article explaining how to move Microsoft Exchange mailboxes in a bulk or one bye one fashion, thus saving a lot of time.





First, let's view all the mailboxes in the database using the following command;


Get-Mailbox -Database Mailboxdb02

Now let's try to move in bulk. Mailboxdb02 is the old database name and Mailboxdb01 is the new database name.


Get-Mailbox -Database Mailboxdb02 | New-MoveRequest - TargetDatabase Mailboxdb01 -BatchName "Mailboxdb02to01"


Now there are cases server memory is not enough (or low bandwidth between servers) to move multiple move request at a time. You can use the below script/command. This will create a move request and monitor the move request every 3 minutes, Once complete it will start the next move request.

foreach ($i in (Get-Mailbox -ResultSize unlimited)) { New-MoveRequest -identity $i -TargetDatabase "TargetDatabaseName" -baditemlimit 50 -acceptlargedataloss ;while ((Get-Moverequest -Identity $i | ? {$_.Status -eq “Queued” -or $_.Status -eq “InProgress” -or $_.Status -eq “WaitingForJobPickup”})) { sleep 180 } }


When the current move is completed you will see an error "Couldn't find a move request that corresponds to the specified /domain/OU/username"  as move status is not equal to queued or inprogress and will start the next move request as below.


Now lets move the system mailboxes to the new database or server. Lets check system mailboxes.

Get-Mailbox -Database "Mailboxdb02" -Arbitration

Next command will move the system/arbitration mailboxes to Mailboxdb01.

Get-Mailbox -Database "MailboxDatabase-Users" -Arbitration | New-MoveRequest -TargetDatabase "MailboxDB01"


Let's check on the progress. You can also set, suspend, remove, resume, and Get-MoveRequestStatistics where we are going to use the last one next.


Get-MoveRequest

What we can do instead, is use piping the Get-MorvRequest and Get-MoveRequestStaticstics. Remember, this will not only display just this last jump if previous jobs are not removed after completion.


Get-MoveRequest | Get-MoveRequestStaticstics


Now let's remove MoveRequest by issuing the following command if all move request is completed:


Get-MoveRequest | Remove-MoveRequest


Let's run Get-MoveRequest again to verify that nothing shows up.


Now all your mailboxes have been moved to a different database.


To get additional support on this process, I encourage you to use the Ask a Question feature at Experts Exchange.


If you found this helpful, please click the Thumbs Up button below and please do share any comments below.


Author: MAS - EE MVE


2
11,163 Views
M AEE Solution Guide - Service Manager
CERTIFIED EXPERT
Most Valuable Expert2017 and 2020.
O365, Exchange Server,Windows Server, Active Directory, Virtualization, Teams and Email Migration Expert.

Comments (3)

Hi,

thanks for the tutorial...by the way i already succeeded moving the mailbox to another database, but when i try to confirm again using "Get-MailboxDatabase -identity "DBNAME" | Get-MailboxStatistics | sort -property totalitemsize | ft displayname,totalitemsize", i still got the mailbox which i was move before still listed n the old database. is the mailbox just copied to new database ?
maybe  there is any script or command to some kind refresh the list or something like that?

best regards,
Yoga
DP230Network Administrator
CERTIFIED EXPERT

Commented:
Hi, when I used move-request command, only about 20 items were processed at the same time, can I increase this number?
M AEE Solution Guide - Service Manager
CERTIFIED EXPERT
Most Valuable Expert 2020
Most Valuable Expert 2017

Author

Commented:
-->only about 20 items were processed at the same time, can I increase this number?
This depends on your server performance..

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.

Get access with a 7-day free trial.
You Belong in the World's Smartest IT Community