An Exchange administrator can move user mailboxes between databases on the same server or between remote mailbox servers. In this article we’ll show how to move mailboxes in Exchange Server using the Exchange Admin Center (EAC) and PowerShell. The article is relevant for all supported versions of Exchange 2010/2013/2016/2019 with some differences regarding the Exchange Management GUI.
Typically, corporate mailboxes in an Exchange organization are migrated if a user moved to another site (office) with their own Exchange mailbox servers; when the disk space where the current database is stored runs out; or when you want to perform an offline defragmentation of the database without interrupting the email service for users.
white space
). This free space can be used to store new mailbox items for other users in the same database. To reduce the size of the Exchange database, you have either to defragment it offline or simply recreate it (move users to other databases in advance).To move a mailbox from a database to another one, you need to create an Exchange move request. There are three types of move requests:
- Local move is a local request to move a mailbox in the same forest (from one database to another on the same mailbox server, or to another server in the same Exchange organization);
- Cross-forest enterprise move – moves mailboxes between different Active Directory forests;
- Remote mailbox moves used in hybrid deployment to move mailboxes in hybrid configurations (between on-premises Exchange and Office 365).
How to Move Mailboxes Using Exchange Admin Center (EAC)?
Using the Exchange Admin Center, you can move one or more user mailboxes.
- Open the EAC and go to the Recipients -> Migrations tab;
- Click + and select Move to a different database;
- Select the user mailboxes you want to move; You can specify the list of mailboxes to migrate in a CSV file and upload it to the EAC.
- Then specify a target mailbox database you want to move mailboxes to;
- Then you may select if you want to start moving immediately or later, and specify the mailbox to deliver a report about successful mailbox moving.
I don’t use the EAC mailbox moving features, since it is easier and faster to do it with PowerShell.
Moving Exchange Mailboxes with the New-MoveRequest PowerShell Cmdlet
First of all, you need to get the mailbox database that stores the user’s mailbox. Open the Exchange Management Shell (EMS) and run this command:
Get-Mailbox jkurtin| Format-List Database
In this example, a user’s mailbox is located in the database named DB01.
To create a local request to move a mailbox, the New-MoveRequest cmdlet is used. For example:
New-MoveRequest -Identity jkurtin -TargetDatabase "DB02" –BadItemLimit 10
Besides a username, the following parameters are important:
- TargetDatabase is the name of a target mailbox database you want to move a mailbox to;
- BadItemLimit – the number of damaged items in the mailbox that may be skipped (ignored) while moving the mailbox.If you set BadItemLimit 0, the mailbox won’t be moved to the target database if any corrupted items are found. If you set BadItemLimit > 50, you must additionally specify the AcceptLargeDataLoss parameter.
The cmdlet returns the mailbox and archive sizes (TotalMailboxSize, TotalArchiveSize) and a message that the move request has been queued.
To move all mailboxes from an Exchange database to another one, use the following command:
Get-Mailbox -Database DB01 -ResultSize Unlimited | New-MoveRequest -TargetDatabase DB02
Get-Mailbox -Database DB01 -Arbitration | New-MoveRequest -TargetDatabase DB02
MaxActiveMovesPerSourceMDB
, MaxActiveMovesPerTargetMDB
, MaxActiveMovesPerSourceServer
, MaxActiveMovesPerTargetServer
.Depending on the mailbox size and the location of a target server, it may take a long time to move a mailbox. To track the mailbox migration status in %, the Get-MoveRequestStatistics cmdlet is used.
Get-MoveRequestStatistics -Identity jkurtin
In this example, the move status is InProgress, and the progress (PercentComplete) is 26%.
You can display the status of all mailbox move requests in the organization:
Get-MoveRequest | Get-MoveRequestStatistics
After the migration is over, the PercentComplete value reaches 100, and the migration status will change to Completed.
Get-MoveRequest | where {$_.status -ne "completed"} | Get-MoveRequestStatistics | ft -a displayname,status*,percent
To display all mailboxes that are being moved or queued:
Get-MoveRequest -movestatus inprogress
Get-MoveRequest -movestatus queued
If an error occurred during the mailbox migration, you can display it using this command:
Get-MoveRequest jkurtin | Get-MoveRequestStatistics | fl *failure*, message
To get more detailed information about mailbox migration errors, use the following command:
Get-MoveRequest -resultsize unlimited | Where-Object {$_.status -like “failed”} | Get-MoveRequestStatistics -IncludeReport | select DisplayName, Message, FailureType, FailureSide, FailureTimeStamp, *bad*, *large*, Report, Identity | fl
If you want to cancel a mailbox move, run:
Remove-MoveRequest -Identity jkurtin
To remove successfully completed move requests (you won’t be able to move a mailbox next time without it), run the command:
Get-MoveRequest -MoveStatus Completed | Remove-MoveRequest
Batch Mailbox Migration in Exchange Server
To make tracking mailbox migration more convenient, you may use the –BatchName option. For example, to move all mailboxes from a mailbox database to another one in batch mode, run the following command:
Get-Mailbox -Database RO-DB01 | New-MoveRequest -TargetDatabase RO-DB02 -BatchName RODB01toRoDB02Move20210422
Then to get a migration status of all mailboxes in the batch, specify the batch name:
Get-MoveRequest -BatchName RODB01toRoDB02Move20210422| Get-MoveRequestStatistics
Thus, you can make sure that all mailboxes in the task have been successfully moved.
You can suspend a batch mailbox migration:
Get-MoveRequest | ? {$_.Batchname –like “*RODB01toRoDB02Move20210422”}|Set-MoveRequest –SuspendWhenReadytoCompleate
Or resume the migration:
Get-MoveRequest | ? {$_.Batchname –like “*RODB01toRoDB02Move20210422”|Resume-MoveRequest
In Exchange Server 2013, 2016, 2019 and Exchange Online, you can move multiple mailboxes in a batch using the New-MigrationBatch. Make a list of mailboxes to be migrated in a CSV file, and use this command:
New-MigrationBatch -Local -AutoStart -AutoComplete -Name RODB01Move20210422 -CSVData ([System.IO.File]::ReadAllBytes("C:\PS\RODB01Move20210422.csv")) -TargetDatabases RO-DB03 -BadItemLimit 10
PrimaryOnly
option; to move an archive mailbox, use ArchiveOnly
.
6 comments
to suspned a move request, you should use
Get-MoveRequest -MoveStatus InProgress| ? {$_.Batchname –like “*dbmov01”}|Suspend-MoveRequest -Confirm:$false
instead of
Set-MoveRequest –SuspendWhenReadytoCompleate
Hi there.
I have move couple mailboxes from a database that is getting full to another database. But the database still with the same size after moving couple mailboxes from that database.
I would like to know how can recover that space of those mailboxes that were moved.
You’re talking about white space in Exchange databases.
Whitespace is the free space area in Exchange databases, that is created after you delete or move an item or object (mailbox)
To check for whitespaces in a mailbox database:
Get-MailboxDatabase DBNAME -status | Select-Object Server,Name,AvailableNewMailboxSpace
You can remove whitespaces using offline deragmentation or by recreating the mailbox database after moving all mailboxes.
Do not move too many mailboxes at one time. Some mailboxes may fail to migrate. You need to check the failure reason and re-migrate.
Batch migration of mailboxes does not require downtime. The process of moving mailboxes may affect user use. Usually, the moving speed of a single mailbox is relatively fast, so the impact will not be too great.
¿cuando se realiza la migración de usuarios de una bd a otra dentro del mismo servidor se migrar las configuraciones individuales del buzón así como cuando se migra de una bd de un server a otra bd en un servidor diferente?
When migrating users from one database to another within the same server, will individual mailbox settings be migrated as well as when migrating from one database on one server to another database on a different server?
Yes, when mailboxes are moved between Exchange databases, they are transferred with their settings (the mailbox settings are stored in AD).