An error appears when you want to create a mailbox in Exchange Server. It doesn't…
Move mailbox to another database with PowerShell
You can move a mailbox in Exchange 2010/2013/2016/2019 to another database with PowerShell. However, there is another way than with PowerShell. That is with Exchange Control Panel (ECP). I recommend doing it with Exchange Management Shell (EMS). The ECP is not always fast in refreshing the results. In this article, we will move a mailbox to another database with PowerShell.
Table of contents
Information
We have a user called John Doe, and his email is john.doe@exoip.com. We want to move the user mailbox to another database with PowerShell.
Note: Before moving the mailbox to another database, make sure you have read the article Exchange database best practices.
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.
Get mailbox information with PowerShell
Let’s first check which database the user is currently on. Run Exchange Management Shell as administrator and run the Get-Mailbox cmdlet. You can search by user email address or the name of the user.
The primary mailbox and archive mailbox locations are in database DB01.
[PS] C:\>Get-Mailbox "john.doe@exoip.com" | Format-Table Name,PrimarySmtpAddress,Database,ArchiveDatabase
Name PrimarySmtpAddress Database ArchiveDatabase
---- ------------------ -------- ---------------
John Doe John.Doe@exoip.com DB01 DB01
[PS] C:\>Get-Mailbox "John Doe" | Format-Table Format-Table Name,PrimarySmtpAddress,Database,ArchiveDatabase
Name PrimarySmtpAddress Database ArchiveDatabase
---- ------------------ -------- ---------------
John Doe John.Doe@exoip.com DB01 DB01
Now that we know that the primary mailbox and archive mailbox are in DB01, let’s look at the next step on how to move the mailboxes.
Move primary mailbox and archive mailbox with PowerShell
Move the primary mailbox and archive mailbox to another database. We will move the primary mailbox and archive mailbox to database DB02.
Let’s run the New-MoveRequest cmdlet.
[PS] C:\>New-MoveRequest "john.doe@exoip.com" -TargetDatabase "DB02"
DisplayName StatusDetail TotalMailboxSize TotalArchiveSize PercentComplete
----------- ------------ ---------------- ---------------- ---------------
John Doe WaitingForJobPickup 4.891 GB (5,251,716,383 bytes) 810.9 KB (830,394 bytes) 0
Another option is to move the primary mailbox and archive mailbox to different mailbox databases. Let’s move the primary mailbox to DB02 and the archive mailbox to DB03.
[PS] C:\>New-MoveRequest "john.doe@exoip.com" -TargetDatabase "DB02" -ArchiveTargetDatabase "DB03"
DisplayName StatusDetail TotalMailboxSize TotalArchiveSize PercentComplete
----------- ------------ ---------------- ---------------- ---------------
John Doe WaitingForJobPickup 4.891 GB (5,251,716,383 bytes) 810.9 KB (830,394 bytes) 0
Move primary mailbox only with PowerShell
Suppose we want to move the primary mailbox only. We have to add the -PrimaryOnly parameter to the command.
[PS] C:\>New-MoveRequest "john.doe@exoip.com" -TargetDatabase "DB02" -PrimaryOnly
DisplayName StatusDetail TotalMailboxSize TotalArchiveSize PercentComplete
----------- ------------ ---------------- ---------------- ---------------
John Doe WaitingForJobPickup 4.891 GB (5,251,716,383 bytes) 0
Move archive mailbox only with PowerShell
If we want to move the archive mailbox only, we need to add the -ArchiveTargetDatabase and the -ArchiveOnly parameters to the command.
[PS] C:\>New-MoveRequest "john.doe@exoip.com" -ArchiveTargetDatabase "DB02" -ArchiveOnly
DisplayName StatusDetail TotalMailboxSize TotalArchiveSize PercentComplete
----------- ------------ ---------------- ---------------- ---------------
John Doe WaitingForJobPickup 0 B (0 bytes) 812.4 KB (831,851 bytes) 0
Check mailbox move progress with PowerShell
Run the Get-MoveRequest cmdlet and Get-MoveRequestStatistics cmdlet to check the mailbox move status.
[PS] C:\>Get-MoveRequest | Get-MoveRequestStatistics
DisplayName StatusDetail TotalMailboxSize TotalArchiveSize PercentComplete
----------- ------------ ---------------- ---------------- ---------------
John Doe CopyingMessages 4.891 GB (5,251,716,383 bytes) 812.4 KB (831,851 bytes) 84
Messages are being copied. Run the command again.
[PS] C:\>Get-MoveRequest | Get-MoveRequestStatistics
DisplayName StatusDetail TotalMailboxSize TotalArchiveSize PercentComplete
----------- ------------ ---------------- ---------------- ---------------
John Doe Completed 4.891 GB (5,251,716,383 bytes) 812.4 KB (831,851 bytes) 100
When the mailbox completes, you will see that john.doe@exoip.com is 100% completed.
Verify mailbox move completion with PowerShell
Check if the user mailbox and archive mailbox are moved to the new database.
[PS] C:\>Get-Mailbox "john.doe@exoip.com" | Format-Table Name,PrimarySmtpAddress,Database,ArchiveDatabase
Name PrimarySmtpAddress Database ArchiveDatabase
---- ------------------ -------- ---------------
John Doe John.Doe@exoip.com DB02 DB03
Both the mailboxes have been successfully moved. Will you move the mailbox to Exchange 2010/2013/2016/2019 with PowerShell?
Read more: Move all mailboxes from one database to another »
Conclusion
You learned how to move a mailbox in Exchange 2010/2013/2016/2019 to another database with PowerShell. I hope you can make good use of these commands and that a mailbox migration to another database will go great. It’s always good to keep these commands by your side if you need to move a mailbox to another database in the future.
Did you enjoy this article? You may also like Cleanup logs Exchange 2013/2016/2019. Don’t forget to follow us and share this article.
Thanks a lot.
Nice. Thank you a lot.
Thanks Ali,
Such a helpful info.
Greetings and Regards .
There is a problem in my email server, that is, despite having a retention policy, newly created users are not able to archive their emails older than 60 days. Is there a command to manually force those who have an active archive to move old emails to the archive server? Thank you for helping me.
Thanks Ali
for this article helping to understand move requests. I was wondering why there is no copy request or something else to copy the content of a mailbox to another mailbox.
Investing some time finding a cmdlet I wasnt successful. What is the best why to copy data from a mailbox to another mailbox? Simple export/import to a PST cant be the only way, I guess. Any other ideas?
Cheers
Michael
Clean and simple!! love it
Thank you so much!
Hi,
Thanks for this manual. Would be great also to add parameter for sending email, when move is initiated and done. Doing this via ECP provides this feature.
Hi Andrejs,
The New-MoveRequest cmdlet does not have a parameter to send notification emails. But, this is possible if you want to move mailboxes with the New-MigrationBatch cmdlet.
The Exchange Admin Center (EAC) makes use of the New-MigrationBatch cmdlet and not the New-MoveRequest cmdlet.
Read more about the difference in the following article: New-MigrationBatch or New-MoveRequest in Exchange