Moving Mailboxes in Exchange 2010 (Part 3)

If you would like to read the other parts in this article series please go to

Introduction

This is the third part of an article series looking at the process of moving mailboxes within the same forest using the new move request feature of Exchange 2010. In parts one and two of this article series we have covered a bit of background regarding the move request feature and we have seen how move requests can be created using the Exchange Management Console as well as the Exchange Management Shell. We have also looked at the properties of a move request so that we can obtain more information on the state of that particular move request. Here in part three we will continue our look at managing move requests using the Exchange Management Shell.

Managing Move Requests

It is also possible to use the Exchange Management Shell to see how the move requests are progressing using the Get-MoveRequest cmdlet. In its default state, the Get-MoveRequest cmdlet will return all move requests that are currently available. For example, look at Figure 13 where you can see a sample of the information returned by the Get-MoveRequest cmdlet. Here you can see that just a single move request is currently available and that my mailbox has been moved to a target database called TEST. You can also see that the move request has completed.


Figure 13: Results of Get-MoveRequest

Like the New-MoveRequest cmdlet, there are many parameters available for the Get-MoveRequest cmdlet. A full list of the parameters available can be found here. A few of the more useful parameters are:

MoveStatus: With this parameter, you can refine the output of the Get-MoveRequest cmdlet to only return move requests with a particular move status. For example, if you wanted to see all move requests that had a status of InProgress, you would run the following cmdlet:

Get-MoveRequest –MoveStatus InProgress

An example of the output of this parameter is shown in Figure 14. Valid move status parameters are None, Queued, InProgress, AutoSuspended, CompletionInProgress, Completed, CompletedWithWarning, Suspended and Failed.


Figure 14: Move Requests With a Specific Status

SourceDatabase: This parameter shows you all mailboxes that are being moved from a particular source database, so this could be useful for determining the load against a source mailbox server.

SuspendWhenReadyToComplete: This parameter is used to suspend the move request before the mailbox is finally moved to the target database. We will be covering this parameter later in this article.

TargetDatabase: This is like the SourceDatabase parameter, only for the target database this time.

Suspending Move Requests

As we briefly discussed in part two of this article series as well as in the previous section, the New-MoveRequest and Get-MoveRequest cmdlets include the SuspendWhenReadyToComplete parameter that is used to suspend a move request before the final target database location is updated. With this approach, the mailbox data is moved but the final switch is only made once the suspended move request is resumed. It is also possible to suspend an existing move request using the Suspend-MoveRequest cmdlet.

Let’s look at using the SuspendWhenReadyToComplete parameter of the New-MoveRequest cmdlet. An example cmdlet to run is:

New-MoveRequest –Identity neil –SuspendWhenReadyToComplete

If you have been reading the previous parts of this article series, you will notice that the above cmdlet does not include the TargetDatabase parameter to specify any particular database to which the mailbox will be moved. Without this parameter, a mailbox database will be chosen by the system.

As we have mentioned, the mailbox move process will be suspended before the final switchover takes place. This can be confirmed by running the Get-MoveRequest cmdlet. Consider Figure 15 where you can see that a mailbox has been moved using the SuspendWhenReadyToComplete parameter. A short while later, the status of this move request can be seen as InProgress, where the mailbox contents are moved across. Another refresh of the Get-MoveRequest cmdlet shows that the status of the move request has now changed to AutoSuspended, which is the status that is reached when the SuspendWhenReadyToComplete parameter is used. Similarly, the Exchange Management Console shows this status as you can see in Figure 16.


Figure 15: Suspended Move Request – Exchange Management Shell


Figure 16: Suspended Move Request – Exchange Management Console

Once the administrator is happy for the mailbox move to complete fully, the move request can be resumed simply by running the Resume-MoveRequest cmdlet such as:

Resume-MoveRequest –Identity neil

Once this cmdlet has been executed, re-running the Get-MoveRequest cmdlet should reveal that the move request now has a status of Completed.

Batch Names

Back in part two of this article series we looked at the parameters of the New-MoveRequest cmdlet and saw that one of these parameters is called BatchName. Using this parameter, a batch name can be specified when moving multiple mailboxes which can then be used with the Get-MoveRequest cmdlet to search for particular batches of mailbox moves.

Batch names might ordinarily make sense when moving the contents of one mailbox database to another. To simplify things, I am simply going to create two move requests for single mailboxes and assign each with a different batch name. We will then use the Get-MoveRequest cmdlet to show that you can then search for these batch names. First, let us create two simple move requests using the Exchange Management Shell and specifying different batch names:

New-MoveRequest –Identity neil –TargetDatabase ‘Mailbox Database 003’ –BatchName Batch001

New-MoveRequest –Identity rob –TargetDatabase ‘Mailbox Database 004’ –BatchName Batch002

Once these move requests have been created, it is then possible to use the Get-MoveRequest cmdlet with the BatchName parameter to locate all mailbox move requests that are associated with the relevant batch name. For example, to view all mailbox move requests that are associated with the batch name of Batch001, the cmdlet to use will be:

Get-MoveRequest –BatchName Batch001

You can see the results of this cmdlet in Figure 17 where you can see that only one of the two mailboxes is returned since the other mailbox was moved using a different batch name.


Figure 17: Filtering For Batch Names

Moving Multiple Mailboxes

In part two of this article series we looked at moving a user mailbox with the New-MoveRequest cmdlet. Moving a single mailbox is easy as that mailbox alias simply needs to be passed to the New-MoveRequest cmdlet’s Identity parameter. How about moving multiple mailboxes? That can be achieved via a variety of methods some of which I will outline here.

First, it is very easy to move all mailboxes on a database to another database simply by piping the Get-MailboxDatabase cmdlet into the New-MoveRequest cmdlet. An example of such an action is as follows:

Get-Mailbox –Database ‘Mailbox Database 001’ | New-MoveRequest –TargetDatabase `

  ‘Mailbox Database 002’

If you have just a few mailboxes to move, you could consider using the array feature in PowerShell. Let’s suppose we wish to move mailboxes belonging to Neil, Rob and Mark. In this example, the users’ names are also the mailbox aliases. Consider this script to accomplish this task:

$MailboxesToMove = ‘neil’,’rob’,’mark’

ForEach ($SingleMailbox in $MailboxesToMove) {New-MoveRequest –Identity $SingleMailbox `

  –TargetDatabase ‘Mailbox Database 002’ –BatchName Batch001}

In this script you can see that we first define $MailboxesToMove as an array containing the names of three mailbox aliases to move. Then, each mailbox alias is passed into the New-MoveRequest cmdlet for processing regardless of the source database location of the mailboxes.

You could also consider using the Get-Content cmdlet found in PowerShell. First you would need to create a simple text file containing the list of mailbox aliases that you would like to move. See Figure 18 for an example of such a file, where the file is called mailboxes.txt.


Figure 18: Sample Mailboxes.txt File

Next an example script to move the mailboxes listed in the mailboxes.txt file could look like the script shown below:

$Mailboxes = Get-Content ./mailboxes.txt

For ($Start = 0; $Start -lt $Mailboxes.length; $Start++) {New-MoveRequest –Identity `

  $Mailboxes[$Start] -TargetDatabase ‘Mailbox Database 002’}

In this script, the Get-Content cmdlet is used to retrieve the contents of the mailboxes.txt file and assign the contents to $Mailboxes. Next, a loop is made through the contents of $Mailboxes and for each loop the New-MoveRequest cmdlet is invoked.

We will look at more ways to move multiple mailboxes in part four of this article series.

Summary

That completes part three of this article series on local move requests. In this part, we have seen how we can manage move requests including how we can suspend them. We have also started to look at ways to move multiple mailboxes which we will continue to do in part four but this time we’ll be looking at the MoveMailbox script supplied with Exchange 2010.

If you would like to read the other parts in this article series please go to

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top