Introduction : This document is just about the exchange mailbox migration — I am just covering how can we migrate a single & multiple user’s mailbox – Moving mailbox from one server to another server in the same forest is very simple process which we can  achieve either through powershell scripts or from the exchange console…

First we will start with mailbox movement for single user

 

How to get user mailbox details ?
001
Get-mailbox -Identity viviana
 
How to move mailbox ?
Refer the below important parameters :
 
TargetDatabase : The TargetDatabase parameter specifies whether to return all mailboxes that are being moved to the specified target database.
SuspendWhenReadyToComplete : The SuspendWhenReadytoComplete parameter specifies whether to return mailboxes that have been moved with the New-MoveRequest command and its SuspendWhenReadyToComplete
BadItemLimit : The BadItemLimit parameter specifies the maximum number of bad items that are allowed before the request fails. A bad item is a corrupt item in the source mailbox that can’t be copied to the target mailbox. Also included in the bad item limit are missing items. Missing items are items in the source mailbox that can’t be found in the target mailbox when the request is ready to complete.


Before move request, you can validate if you want to know what is actually going to happen by using -whatif cmdlet — & use the above important parameters which may required in your production environment.

001
New-MoveRequest –identity viviana –TargetDatabase MDB02 -whatif
I just used -whatif for validating what exactly going to happen — Rerun the same command by removing -whatif  for mailbox movement
 
001
New-MoveRequest –identity viviana –TargetDatabase MDB02


We can suspend or remove the move request – If you suspend the move request, that can be resumed, but removed move request can’t be resumed back.

001
002
Suspend-MoveRequest -Identity viviana
Remove-MoveRequest -Identity viviana

 

How to check the status of move request ?

 

001
002
003
004
Get-MoveRequest
#—– We can also select particular properties as showing below
Get-MoveRequest | select DisplayName,Alias,Status,TargetDatabase,percentcomplete
Get-MoveRequestStatistics -Identity viviana

 

 
If you used SuspendWhenReadytoComplete parameter, you need to resume the move request in order to complete the move request – See the below command
 
001
Resume-MoveRequest -Identity viviana
Mailbox movement for Multiple Users

As per the above examples, we are just migrating a single user – But in production we need to migrate thousands of users –
All we need to do is –  Create an Input file which contains users & database details (Add database column only if we are moving users to multiple database for load balancing purpose, otherwise you can directly mention the database name – like moving single user)

Batch Name : Batch name is one of the important parameter in new move request in case if we are moving multiple mailboxes. The Batchname parameter specifies a descriptive name for moving a batch of mailboxes
 
I am taking input from a .CSV File — As I am moving mailboxes to different database, included Database column as well in my input file.
Below is my Input File and saved it under C:ProjectInput.csv
 
 

 

As per the below script, we are just directly moving mailboxes – We can use the below important parameters as well.
-SuspendWhenReadyToComplete
-BadItemLimit

001
002
003
004
005
$csvinput = Import-Csv -Path ‘C:ProjectInput.csv’
Foreach ($csv in $csvinput)
{
New-MoveRequest –identity ($csv.alias) –TargetDatabase ($csv.database) -BatchName “TESTMove01”
}

If we are moving mailboxes to the same Database, mention only Alias in CSV file and use the below script — You need to type the database name manually in this case.
Note : We can use notepad as well if we are importing only user details – Replace Import-Csv with Get-Content cmdlet

001
002
003
004
005
$csvinput = Import-Csv -Path ‘C:ProjectInput.csv’
Foreach ($csv in $csvinput)
{
New-MoveRequest –identity ($csv.alias) –TargetDatabase “MDB01” -BatchName “TESTMove01”
}

Move request status

1
2
3
4
5
6
7
8
9
Get-MoveRequest -BatchName "MDB01"
#-- Grid View with selected properties
Get-MoveRequest -BatchName "MDB01" | select DisplayName,Alias,Status,TargetDatabase,percentcomplete | Out-GridView

# we can use the below cmdlet as well

Get-MoveRequestStatistics -BatchName “MDB01” | select DisplayName,Alias,Status,TargetDatabase,percentcomplete | Out-GridView
<# Get-MoveRequestStatistics ::: Some of the failure messages that are returned by this cmdlet are temporary and don’t indicate that a request –
has actually failed. If the Status value is Queued or InProgress,then the request is proceeding normally #>

 

Move request status summary

001
Get-MoveRequest -BatchName “MDB01” | group status -noelement

Export your status report

001
002
Get-MoveRequest -BatchName “MDB01” |select DisplayName,Alias,Status,TargetDatabase,percentcomplete |
Export-Csv -Path “C:ReportOutputt.csv” -NoTypeInformation

                                                     Happy Migration   🙂