?
Solved

Exchange 2003 to Exchange 2010 Mailbox Moves

Posted on 2011-04-29
42
Medium Priority
?
1,488 Views
Last Modified: 2012-11-18
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.
0
Comment
Question by:compdigit44
  • 22
  • 17
  • 3
42 Comments
 
LVL 8

Expert Comment

by:ckeshav
ID: 35493474
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35493981
Really???
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35494516
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
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
LVL 20

Author Comment

by:compdigit44
ID: 35504193
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
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35504261
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
 
LVL 8

Expert Comment

by:ckeshav
ID: 35504319
I have given the simple solution in my first. Try moving 1 or 2 Mailbox from EMC.
0
 
LVL 20

Author Comment

by:compdigit44
ID: 35504472
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
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35504584
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35504623
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
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35504822
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35504888
Wait a second the the suspend request be schedule to resume at a specific time???
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35504898
No, it cannot directly. You would need to script that or use Windows Scheduler to run the scripts at a specific time.

JJ
0
 
LVL 20

Author Comment

by:compdigit44
ID: 35504985
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35505291
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
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35505517
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35506128
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
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35506246
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35506287
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35506386
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
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35506431
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35506532
If I include the Whatif command will this list out all of the mailboxes that would have been moved?
0
 
LVL 20

Author Comment

by:compdigit44
ID: 35506803
Also How would use this script to move mailboxes in batches of 10
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35506875
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35507665
I keeping getting the message A parameter cannot be found with  -whatif ???
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35507704
The command may not support the -whatif switch.

JJ
0
 
LVL 20

Author Comment

by:compdigit44
ID: 35507767
what is the suppose command then to simulate mailbox moves in 2010 Sp1
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35507831
You won't be able to simulate the moves using the MoveMailbox.ps1 script.

JJ
0
 
LVL 20

Author Comment

by:compdigit44
ID: 35509104
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
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35509136
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35512087
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35512110
When I run the get-mailbox -databae command I keep getting database cannot be found
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35512225
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35512227
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35512308
The information is correct.. Is it becuase 2010 no longer has Storage Groups???????
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35512422
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35513188
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
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35513879
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
 
LVL 20

Author Comment

by:compdigit44
ID: 35515321
Correct I only want to move 30 mailboxes at a time so this is ok then right?
0
 
LVL 20

Author Comment

by:compdigit44
ID: 35515331
why does everything have to be on one line?
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 35515335
Yes, this should work they way you want.

JJ
0
 
LVL 37

Accepted Solution

by:
Jamie McKillop earned 2000 total points
ID: 35515355
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

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
In this video we show how to create an Address List in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Organization >> Ad…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question