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)
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.
No comments:
Post a Comment