Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Exchange / Moving Exchange Mailboxes to Different Database

July 26, 2021 ExchangePowerShell

Moving Exchange Mailboxes to Different Database

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.

Contents:
  • How to Move Mailboxes Using Exchange Admin Center (EAC)?
  • Moving Exchange Mailboxes with the New-MoveRequest PowerShell Cmdlet
  • Batch Mailbox Migration in Exchange Server

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.

Note that moving or deleting a mailbox doesn’t reduce the mailbox database size on a disk, it only frees some space in the database (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.

  1. Open the EAC and go to the Recipients -> Migrations tab;
  2. Click + and select Move to a different database; exchange admin center - move mailbox to a different database
  3. Select the user mailboxes you want to move; select exchange mailboxes to move
    You can specify the list of mailboxes to migrate in a CSV file and upload it to the EAC.
  4. Then specify a target mailbox database you want to move mailboxes to;
  5. 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.

exchange migration batch settings

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

get the exchange mailbox database for a specific user

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.

Migrate Exchange Mailboxes to another database using New-MoveRequest cmdlet

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

Note that the Arbitration option must be used to move system mailboxes:

Get-Mailbox -Database DB01 -Arbitration | New-MoveRequest -TargetDatabase DB02

You can change mailbox migration settings in the configuration file MSExchangeMailboxReplication.exe.config (C:\Program Files\Microsoft\Exchange Server\V15\Bin). For example, you can increase the number of simultaneous move request operations supported for a mailbox database or a mailbox server. These are the following options: 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%.

Get-MoveRequestStatistics - monitoring exchange mailbox moves

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 | Get-MoveRequestStatistics for all active move requests in exchange organization

You can display statistics on pending move request transfers only:

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

To move only the primary mailbox, use the PrimaryOnly option; to move an archive mailbox, use ArchiveOnly.

6 comments
3
Facebook Twitter Google + Pinterest
previous post
Mapped Network Drives are Not Showing in Elevated Programs
next post
How to Clean Up and Compress the WinSxS Folder on Windows 10/Windows Server?

Related Reading

How to Connect VPN Before Windows Logon

November 14, 2023

Send Emails with Microsoft Graph API and PowerShell

November 6, 2023

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

October 15, 2023

6 comments

ng September 27, 2021 - 5:46 am

to suspned a move request, you should use
Get-MoveRequest -MoveStatus InProgress| ? {$_.Batchname –like “*dbmov01”}|Suspend-MoveRequest -Confirm:$false
instead of
Set-MoveRequest –SuspendWhenReadytoCompleate

Reply
Tulio September 29, 2021 - 5:10 pm

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.

Reply
admin September 30, 2021 - 2:13 pm

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.

Reply
jim December 23, 2022 - 3:36 pm

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.

Reply
Arleth March 7, 2023 - 12:17 am

¿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?

Reply
admin March 15, 2023 - 10:02 am

Yes, when mailboxes are moved between Exchange databases, they are transferred with their settings (the mailbox settings are stored in AD).

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • How to Connect VPN Before Windows Logon

    November 14, 2023
  • Removing Azure Arc Setup Feature on Windows Server 2022

    November 9, 2023
  • Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

    November 7, 2023
  • Send Emails with Microsoft Graph API and PowerShell

    November 6, 2023
  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Outlook Keeps Asking for Password on Windows
  • How to Manually Configure Exchange or Microsoft 365 Account in Outlook 365/2019/2016
  • Whitelist Domains and Email Addresses on Exchange Server and Microsoft 365
  • FAQ: Licensing Microsoft Exchange Server 2019/2016
  • How to Cleanup, Truncate or Move Log Files in Exchange Server 2013/2016/2019?
  • Search and Delete Emails from User Mailboxes on Exchange Server (Microsoft 365) with PowerShell
  • Fix: Microsoft Outlook Search Not Working on Windows 10/11
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top