Exchange 2003 to Exchange 2010 Mailbox Moves

The experts in the Exchange forum help me build the following powersheel script...

MBX = get-mailbox -Database "Server1\Second Storage Group\Mail Store (Server)"
$MBX | ./MoveMailbox.ps1 -targetdatabase "Server2\Mailbox Database 0446449042" -Whatif

My new exchange server is Exchange 2010 Sp1. My goal is to schedule these mailbox moves off hours have have the move request automatically cleared.

Wht I run the aboce command I keep getting and error stating -whatif is not a vaild parameter.
LVL 20
compdigit44Asked:
Who is Participating?
 
Jamie McKillopConnect With a Mentor IT ManagerCommented:
It has to be all on one line because it is a single command... well actually two command but piped together. You can split it up to two lines but you need to put the ` character at the end of the first line to tell powershell that the command continues on the next line.

JJ
0
 
ckeshavSr. Infrastructure SpecialistCommented:
You can schedule it even from the EMC, Select the mailboxes which you want to move and in the Move schedule windows select instead of immediately select the time.

You can do different selection by opening new windows
0
 
compdigit44Author Commented:
Really???
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
Jamie McKillopIT ManagerCommented:
Hello,

There are a couple of syntax issues with the script. Here is how I would write it:

get-mailbox -Database "Server1\Second Storage Group\Mail Store (Server)" | .\MoveMailbox.ps1 -targetdatabase "Server2\Mailbox Database 0446449042" -Whatif

The -whatif switch executes the script without making any changes. You should remove this switch when you are ready to run the script and have it actually move the mailboxes.

JJ
0
 
compdigit44Author Commented:
Thanks Everyone.. But I'm interested to know if these 2003 to 2010 mailboxes moves can be scheudle of queued up using the GUI??? If I were to setup a new Local Move request and select suspend from what I have read, it would appear the wizard completes and the moves would like look likw it was moved but when you check the Move REquest it is QUEUED, How could I setup the move to finish the move starting at a specific time.
0
 
Jamie McKillopIT ManagerCommented:
When you use the GUI, you will be presented with the option to move the mailbox now or schedule the move in the future. Simply enter the date and time you want to move to start and it will wait until that time.

JJ
0
 
ckeshavSr. Infrastructure SpecialistCommented:
I have given the simple solution in my first. Try moving 1 or 2 Mailbox from EMC.
0
 
compdigit44Author Commented:
WIll I need to click on NEW in the move request wizard in order to see the schedule screen.
CAn you send me a screen shot
0
 
ckeshavSr. Infrastructure SpecialistCommented:
0
 
Jamie McKillopIT ManagerCommented:
OK, I see you are running Exchange 2010. Unfortunately, you cannot schedule moves either in the GUI or directly in the powershell command. What you would need to do to schedule the move at a specific time is to either build the scheduling into your powershell script or use Windows scheduler to run the script at a specific time.

JJ
0
 
compdigit44Author Commented:
Now I'm confused I have one person saying YES and the other person saying NO...

What is the purpose the the Suspend move request then?
0
 
Jamie McKillopIT ManagerCommented:
With 2007 you could schedule the time the move would would take place but with 2010, you cannot.

The purpose of the suspend command is to move all the initial content to the new server but the mailbox isn't locked down and switched to the new location until the move is resumed.

JJ
0
 
compdigit44Author Commented:
Wait a second the the suspend request be schedule to resume at a specific time???
0
 
Jamie McKillopIT ManagerCommented:
No, it cannot directly. You would need to script that or use Windows Scheduler to run the scripts at a specific time.

JJ
0
 
compdigit44Author Commented:
What you you suggest to do use the powershell script you list earlier to use a script to clear the move request???

Please help not very good in powershell
0
 
compdigit44Author Commented:
Regarding the script that was posted..

get-mailbox -Database "Server1\Second Storage Group\Mail Store (Server)" | .\MoveMailbox.ps1 -targetdatabase "Server2\Mailbox Database 0446449042" -Whatif


I was told I would need a variable becuase that is what the ./movemailbox.ps1 needed?
How could I only move 10 mailboxes at a time?
Where should I save this PSQ to I can schedule it via task scheduler?
Will this clear the move requst?
What will happen if a corrupted message it encountered?
0
 
Jamie McKillopIT ManagerCommented:
You don't need a variable. If you look at Example 1 here - http://technet.microsoft.com/en-us/library/dd876878.aspx you will see they are piping get-mailbox directly to movemailbox.ps1

You can use the -startbatchsize switch to move mailboxes in group of any number.

Move requests are cleared once complete. You genreally talk about clearing the move request if you are going to use the suspend switch.

If a corrupt item is encountered, the move will fail. You can use the -BadItemCount switch to specify a number of corrupt items to skip.

Here is a powershell script you could use to schedule it. Set whatever you want in the $MoveTime Variable.

$MoveTime = "Tuesday, May 03, 2011 11:00:00 PM"
$MoveTime = [datetime]::Parse(($MoveTime))

Do {
    $Now = Get-Time
}
While ($Now -lt $MoveTime)

get-mailbox -Database "Server1\Second Storage Group\Mail Store (Server)" | .\MoveMailbox.ps1 -targetdatabase "Server2\Mailbox Database 0446449042"

JJ

0
 
compdigit44Author Commented:
WOW!!!!
I would save this as a PS1 file correct? Does it matter where I save the file? Desktop, root of C:\ drive??
If a corrupt mailbox is encounter with all mailbox moves fail or will the move move onto the next mailbox?
Where would I use the -whatif command. Will this command should we which mailbox would have been moved?
0
 
Jamie McKillopIT ManagerCommented:
Yes, you would save it as a ps1. It doesn't matter where you save it. You just right-click the file a select Run in Powershell. If a corrupt item is encountered, it will move on to the next mailbox. You don't use the -whatif switch unless you want to test the script without it actually doing anything. In that case, just add it to the end of the line that starts with get-mailbox

JJ
0
 
compdigit44Author Commented:
The following article stats that I could use task schedule to schedule the start time of a powershell script.. How would i do with wit the scritp you wrote above?

Does it matter where I save the script?
0
 
compdigit44Author Commented:
When I copy and paste the following into notepad and save it as a PS1 file I gett the message .\Movemailbox.ps1 is not a recongized cmdlet..... I saved my PS1 file to the root of my C:\ drive..

get-mailbox -Database "Server1\Second Storage Group\MBX1" | .\MoveMailbox.ps1 -targetdatabase

"Server2\Mailbox Database 0446449042" -Whatif
0
 
Jamie McKillopIT ManagerCommented:
Save both the script and MoveMailbox.ps1 to C:\Windows\System32\WindowsPowerShell\v1.0

If you are going to use task scheduler, you don't need the full script I wrote. The point of that script is to run it at any time and it will wait until the predefined time to run the command. If you want to use task scheduler, just create a .ps1 with the following line:

get-mailbox -Database "Server1\Second Storage Group\Mail Store (Server)" | .\MoveMailbox.ps1 -targetdatabase "Server2\Mailbox Database 0446449042"

Now, create a batch file with the line:

powershell -command "& 'c:\windows\system32\windowspowershell\v1.0\script.ps1' "

Go into task scheduler and setup a task to run the batch file whenever you want it to move the mailboxes.

JJ
0
 
compdigit44Author Commented:
If I include the Whatif command will this list out all of the mailboxes that would have been moved?
0
 
compdigit44Author Commented:
Also How would use this script to move mailboxes in batches of 10
0
 
Jamie McKillopIT ManagerCommented:
I'm not sure if it will show you which mailboxes would be moved. Give it a try.

If you want to move in batches of 10, this would be the command:

get-mailbox -Database "Server1\Second Storage Group\MBX1" | .\MoveMailbox.ps1 -targetdatabase "Server2\Mailbox Database 0446449042" -startbatchsize 10

JJ
0
 
compdigit44Author Commented:
I keeping getting the message A parameter cannot be found with  -whatif ???
0
 
Jamie McKillopIT ManagerCommented:
The command may not support the -whatif switch.

JJ
0
 
compdigit44Author Commented:
what is the suppose command then to simulate mailbox moves in 2010 Sp1
0
 
Jamie McKillopIT ManagerCommented:
You won't be able to simulate the moves using the MoveMailbox.ps1 script.

JJ
0
 
compdigit44Author Commented:
Could I do this may be??????

get-mailbox -Database "Server1\Second Storage Group\MBX1" -whatif | .\MoveMailbox.ps1 -targetdatabase "Server2\Mailbox Database 0446449042" -startbatchsize 10

0
 
Jamie McKillopIT ManagerCommented:
The whatif isn't necessary in that situation since get-mailbox doesn't make any changes. If you just want to verify which mailboxes will be returned, just run the get-mailbox portion of the command which will output the results to the screen.
0
 
compdigit44Author Commented:
OK.. but when I am ready the whole command should work correct?

get-mailbox -Database "Server1\Second Storage Group\MBX1" | .\MoveMailbox.ps1 -targetdatabase "Server2\Mailbox Database 0446449042" -startbatchsize 10

0
 
compdigit44Author Commented:
When I run the get-mailbox -databae command I keep getting database cannot be found
0
 
Jamie McKillopIT ManagerCommented:
So, you ran this command: get-mailbox -Database "Server1\Second Storage Group\MBX1" making sure the server, storage group, and database name match what is actually in your environment?

JJ
0
 
compdigit44Author Commented:
If I use the get-mailbox -server command I get a list of mailboxes but this stinks becuase I have 5 DB on my 2003 server and each mailbox goes into a different DB on the 2010 server and thoughts around this.
0
 
compdigit44Author Commented:
The information is correct.. Is it becuase 2010 no longer has Storage Groups???????
0
 
Jamie McKillopIT ManagerCommented:
Server1\Second Storage Group\MBX1 should be the source database, so that would be your Exchange 2003 server.

The script you have is going to move all mailboxes from a single database on your 2003 server to a single database on your 2010 server. You need to modify and run the script for each database. If you are not looking to do a one-to-one mapping between the servers, the script will need to be written to accomodate how you want to distribute the mailboxes on the 2010 server.

JJ
0
 
compdigit44Author Commented:
OK I think I have my final script writen now.... Does there have to be a space inbetween the pipe and next command.. How does this script look...

get-mailbox -Database "server11\First Storage Group\Mailbox Store (store) -resultsize 30
| .\MoveMailbox.ps1 -targetdatabase "server2\Mailbox Database" -BadItemlimit 30
0
 
Jamie McKillopIT ManagerCommented:
Why have you added the resultsize switch? This will cause the command to only return the first 30 mailboxes. If you want to move only 30 mailboxes at a time, this would be fine.

It otherwise looks fine except that it all needs to be on one line.

JJ
0
 
compdigit44Author Commented:
Correct I only want to move 30 mailboxes at a time so this is ok then right?
0
 
compdigit44Author Commented:
why does everything have to be on one line?
0
 
Jamie McKillopIT ManagerCommented:
Yes, this should work they way you want.

JJ
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.