About Me

My photo
"Smoke me a kipper, I'll be back for Breakfast" - one man's journey through life with IT and all things related to it whether it's purely technical or just for fun...

Note - Any posts on this blog are purely my own personal opinion and do not reflect any opinions of companies and/or people that I mention. All advice is given to help you but I cannot be held responsible for your actions should you decide you want to try these things out yourself!

Monday 19 March 2012

Exchange 2010 - Scheduled Migrations Made Easy


It would appear that in their infinite wisdom, Microsoft have removed the tools to allow you to schedule migrations. During all my 2003-to-2007 migrations I used this feature heavily for overnight moving of mailboxes that needed to be up the next day. But do not fear Exchange geeks for I have found a useful little article from a fellow Exchange blogger that aided me - this is how it's done...


We need two things in order to achieve this:
  • A Powershell script that will move a mailbox (text file to be saved as a .ps1)
  • A list of users that we want to move (text file)
These two components will make up our process and to complete it, we will need to use good old Windows Task Scheduler.

Firstly, create a text file with the list of users you need in it and save it to somewhere to get to. The format should literally be "Firstname Surname", for example "Tom Jenkins". Each entry should be separated by a carriage return:

Tom Jenkins
Joe Bloggs
Steven Wilkinson

Secondly, take this Powershell and save it as move.ps1:

Add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
Get-Content c:\scripts\users.txt |New-MoveRequest -TargetDatabase "Mailbox Store 1" -BadItem 50

Now place both in a folder on the root of C:\ or somewhere easy to get to them.

Next is to create a Windows Scheduled Task to perform the move.ps1 script for you when you need it to run. For this example I am going to run mine at 00:01

From Windows Task Scheduler select "Create Basic Task" and give it a friendly name



Select "One time" if you only wish to do this operation once. You can schedule it for further occurrences if you wish.


Select the date and time you want the task to start


Select "Start a program"


Type in the following commands and arguments as shown


Ensure you tick the box at the bottom of the final dialogue box as we need to modify some settings for the task to ensure it runs correctly - Click Finish


Final settings need to reflect what is shown below. This will allow the task to run even if you are not logged in and also with administrative privileges which is required to run Exchange Powershell.

Click OK and it will ask you to enter your domain administrato credentials. Once complete click OK and the task is ready to go. Enjoy!

No comments:

Post a Comment