Moving Mailboxes in Exchange 2007, Part 2

If you missed the first part in this article series please read Moving Mailboxes in Exchange 2007, Part 1

In part one of this article we looked at the Move Mailbox wizard supplied with the Exchange Management Console as well as the different event log entries that are logged when mailboxes are moved in Exchange 2007. Whilst the Move Mailbox wizard offers a simple interface to get the job of moving mailboxes between databases and servers done, it lacks some of the more granular settings that an administrator will require from time to time. Such parameters can be obtained by using the Exchange Management Shell to move mailboxes. Later in this second part of this article we’ll cover some of the key parameters you might use. For now, let’s look at the log files generated by the process of moving mailboxes.

Move Mailbox Log Files

The Exchange 2007 move mailbox process produces resulting XML and LOG files each time a mailbox move is performed. You can find these files in the \Program Files\Microsoft\Exchange Server\Logging\MigrationLogs folder by default as shown in Figure 14.

Figure 14:
Exchange 2007 Move Mailbox Log Files

Both of these files contain information about the mailbox move process that has just been performed. Samples of the .log and .xml files are shown in Figures 15 and 16.

Figure 15:
Exchange 2007 Log File Contents

Figure 16:
Exchange 2007 XML File Contents

Reading the .log files makes more sense that reading XML files in their raw format as this is not always the easiest thing to do. One answer to that problem is to apply a style sheet. I am going to step back to Exchange 2003 for a moment as I can show you a good example of this. The Exchange 2003 move mailbox process produces a resulting XML file in a similar manner to the Exchange 2007 move mailbox process. The Exchange Server 2003 SDK, which you can download here, includes an XSLT style sheet that can be used to modify the way that you view the XML file produced during the mailbox move. This will give you an idea of what you can do with style sheets if you would like to go down that route. Obviously the style sheet supplied with the SDK only works with Exchange 2003 XML files, so you will need to create your own for the Exchange 2007 XML files, or perhaps a similar style sheet will be released by Microsoft eventually. If you download and install the Exchange Server 2003 SDK, you will find the style sheet, called TaskWizardRun.xslt, under the default folder of \Program Files\Exchange SDK\SDK\Samples\TaskWizard. To apply the style sheet to the XML file all you have to do is to make a change to the XML file. For example, Figure 17 shows the original Exchange 2003 XML file opened in Notepad.

Figure 17:
Exchange 2003 XML File in Notepad

Note the second line which starts with <taskWizardRun. To apply the style sheet, just add the following line of text before the taskWizardRun line:

<?xml-stylesheet type=”text/xsl” href=”TaskWizardRun.xslt”?>

The resulting XML file should now look like the one shown in Figure 18, with the added text highlighted.

Figure 18:
Modified Exchange 2003 XML File

This means that when you now open the XML file in Internet Explorer, it will look like the example shown in Figure 19. See if you can spot the spelling mistake that comes with the style sheet.

Figure 19:
Exchange 2003 XML File With Style Sheet

Moving Mailboxes via the Exchange Management Shell

When using the Exchange Management Shell to move mailboxes, the cmdlet to use is the Move-Mailbox cmdlet. When using this cmdlet, there are many other parameters available to the Exchange administrator that are not available within the Exchange Management Console. In this last section of this article we will look at some of the more interesting parameters that you can use. I am not going to look at all the parameters so make sure you take the time to review the Move-Mailbox cmdlet thoroughly.

First, let us look at a straightforward move of a mailbox from an Exchange 2003 server to an Exchange 2007 server in the same forest. In its basic format, the cmdlet to do this for a mailbox belonging to User3 is:

Move-Mailbox User3 –TargetDatabase “E2K7\First Storage Group\Mailbox Database” –Confirm:$false

Obviously the key parameter here is the –TargetDatabase parameter, which in the above example is configured to move the mailbox to a mailbox database called Mailbox Database within the storage group called First Storage Group on an Exchange 2007 server called E2K7. If you execute this cmdlet, you will see the status of the operation as it progresses through the folders and moves the messages. This is shown in Figure 20. Note the use of the –Confirm:$false parameter which ensures that you do not get the ‘Are you sure?’ prompt before the mailbox is actually moved.

Figure 20:
Mailbox Being Moved via the Management Shell

The –ValidateOnly parameter is useful if you want to see if the mailbox can actually be moved without moving it. In Figure 21, you can see that after running the Move-Mailbox cmdlet with the –ValidateOnly parameter, the Status Message attribute is shown as “This mailbox can be moved to the target database.

Figure 21:
Results of ValidateOnly Parameter

After a successful mailbox move, the Status Message attribute will be set to “This mailbox has been moved to the target database.

You may remember in part one of this article I mentioned that the Move Mailbox wizard that you run from within the Exchange Management Console is multi-threaded but is limited to a maximum of 4 threads. You can increase this number if you use the Exchange Management Shell to move mailboxes. The specific parameter that you need to use is the –MaxThreads parameter, which has a maximum value of 30. However, before you go about setting this parameter to the maximum value of 30, consider where your bottleneck will be if you do this and therefore whether you will really benefit. It may just be that, after testing in your environment, you really do not benefit from a performance perspective from setting the –MaxThreads parameter to more than, say, 10.

Let us now consider the case where you want to move all mailboxes on the default mailbox store of an Exchange 2003 server called DCEXCH to an Exchange 2007 server called E2K7. The mailbox store name on the Exchange 2003 server in this example is Mailbox Store (DCEXCH). In this case, we want to move 10 mailboxes simultaneously. The cmdlet to do this is:

Get-Mailbox –Database “DCEXCH\First Storage Group\Mailbox Store (DCEXCH)” | Move-Mailbox –TargetDatabase “E2K7\First Storage Group\Mailbox Database” –MaxThreads 10

The first portion uses the Get-Mailbox cmdlet to retrieve all mailboxes held on the Exchange 2003 server’s database. This is then followed by the Move-Mailbox cmdlet as normal, but note the addition of the –MaxThreads 10 parameter at the end. The result is a screen that looks like the one shown in Figure 22.

Figure 22:
Moving More Than 4 Mailboxes Simultaneously

Earlier in this article you will remember that we detailed the XML files that are produced when mailboxes are moved and that the default location for these files is the \Program Files\Microsoft\Exchange Server\Logging\MigrationLogs folder. If you want to change the location of the XML log file, you can do this with the Exchange Management Shell via the –ReportFile parameter. Note that you need to include the full path and file name in this parameter. If the folder name does not exist, it will be created for you. An example cmdlet to move User3’s mailbox and log the results into C:\MigLogs\mailboxes.xml is:

Move-Mailbox User3 –TargetDatabase “E2K7\First Storage Group\Mailbox Database” –ReportFile C:\MigLogs\mailboxes.xml –Confirm:$false

Finally, you may remember from part one of this article that the Move Mailbox wizard found within the Exchange Management Console allows you to specify the number of corrupted items that you will tolerate when moving a mailbox. Of course, the same setting exists within the Exchange Management Shell in the form of the –BadItemLimit parameter. As I also said in part one of this article, the maximum value you can specify is 2,147,483,647 which is rather large to say the least. The minimum value is 0, which is another way of ensuring that no bad items are skipped.


In my summary in part one of this article I said that moving mailboxes via the Exchange Management Console is really easy. Well, it is also very easy to move mailboxes using the Exchange Management Shell and there is no doubt that using the shell will be preferred by many administrators due to the extra configuration options available within it.

If you missed the first part in this article series please read Moving Mailboxes in Exchange 2007, Part 1

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