Move Exchange Mailboxes using a CSV

The Problem: Corrupted Exchange System User

Today we faced a challenge. Since one the administrative users in our MS Exchange environment was corrupted, we decided to create a new mailbox database (MDB) and move the users to that new database.  Sound quite easy, don’t you think? Here is what we came up with.

The Solution: Move using CSV files!

The biggest challenge was that we weren’t able to use the Exchange Control Panel to schedule te migrations. Scheduled migrations simply didn’t do anything. Even worse, we can’t even remove the tasks using the Control Panel.  We had to become creative. The solution turned out to be fairly simple: move the mailbox using an CSV file! We exported the e-mailadresses of the mailboxes of all our users to a CSV. With said CSV file plus the Exchange Management Shell we came up with the following, simple piece of code:

 Import-Csv C:\Tempmigration\ToMoveMailboxes.csv | % {New-MoveRequest -Identity $_.UserID -TargetDatabase EX01-MDB02}

What it does

First, it loads the CSV file into the memory:

Import-Csv C:\Tempmigration\ToMoveMailboxes.csv

After this, using the pipe character ( | ) it automatically follows up with making a new moving request (hence the New-Moverequest ) per mailbox. With the $_.UserID command it loads in a username, makes the moverequest using and puts it in queue. It does this for all the rules in the CSV file.


{New-MoveRequest -Identity $_.UserID -TargetDatabase EX01-MDB02}

And behold:

Move in progress
Moves in progress


Since this is a move to another database the user may recieve the following error in their Outlook when the migration is finished:

Error after Exchange moge
Possible error endusers see after Exchange MDB move is don


Indeed, a simple closing and starting of Outlook is enough. Not reboots necessary. Simple as can be!

For more info about the New-MoveRequest commandlet I would like to point out the following article on the Microsoft website.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.