Mailboxes from 2003 to 2010 - sheduled - non powershell solution

Answered Mailboxes from 2003 to 2010 - sheduled - non powershell solution

  • Thursday, November 12, 2009 9:17 PM
     
     
    In Exchange 2003 we liked to use sheduled migration: you could right click a Mailbox and from the Exchange Tasks you could start a wizzard which allowed to move the Mailbox from one Exchange to an other. You had had the opurtunity to tell the system to do it sheduled: for example by night.

    When I start this wizzard and try to migrate a Exchange 2003 Mailbox to 2010 I cant choose the Targetdatabse on the Exchange 2010 Server.

    When I do the same thing in the Echange 2010 UI I cant set a shedule.

    I know form 2010 to 2010 its no problem because the move can be done while the user is online but we need to move from 2003 to 2010 at the moment. How can we shedule a Move today?

All Replies

  • Friday, November 13, 2009 1:50 AM
     
     Proposed Answer
    You cannot move a mailbox from Exchange 2003 to Exchange 2010 using the Exchange 2003 System Manager.  You must perform your move using the cmdlets in Exchange 2010.  That being said there is no direct option to schedule a mailbox move with the cmdlets, the most you can do is prepare the move request and suspend it for later activation.  However, you could make use of task scheduler and MoveMailbox.ps1 script to queue up mailbox moves to occur at the time you decided to kick off your script.

    If you want to move a single mailbox with the MoveMailbox script, then use the following:

    MoveMailbox.ps1 -Identity "mailbox" -TargetDatabase "database"

    If you want to move all mailboxes in a database, then use the following:

    MoveMailbox.ps1 -MailboxDatabase "database1" -TargetDatabase "database2"

    You have to make sure that whichever command you use above, that you call via the following:

    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\scripts\movemailbox.ps1'; Connect-ExchangeServer -auto"

    Personally, I would place the above inside a batch file and call the batch file with the task scheduler.  So, for example to move all mailboxes from one database to another at 2:00 AM, place the following in a batch file called C:\mailboxmoves.bat:

    @ECHO OFF
    PowerShell.exe -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; 'C:\Program Files\Microsoft\Exchange Server\V14\Scripts\MoveMailbox.ps1 -MailboxDatabase database1 -TargetDatabase database2'

    To create the schedule taks via command line, do the following:
    schtasks /create /tn "MoveMailboxes" /tr "c:\mailboxmoves.bat" /sc once /st 02:00:00 /ru System

    and of course, make sure you perform all the above in an Elevated command prompt!
    Sean | http://seanv.wordpress.com
  • Friday, November 13, 2009 1:54 AM
     
     

    Sean, I could easily be wrong here but I don't think a 2003 --> 2010 move can be suspended for activation like the 2007 SP2 --> 2010 moves can be because online moves are only supported with 2007 SP2 and up.


    Brian Day: MCSA 2000/2003, CCNA, MCTS: Microsoft Exchange Server 2010 Configuration, Overall Exchange/AD Geek.
  • Friday, November 13, 2009 4:15 AM
     
     Answered
    You might be correct about the suspended moves, I do not have Exchange 2003 in a test environment to verify.  However, using the task scheduler to kick off a script to move the mailboxes would accomplish what testrrrr is looking to do.

    If anyone can confirm if mailbox moves from 2003 --> 2010 can be suspended, please let us know.  Thanks.
    Sean | http://seanv.wordpress.com
  • Friday, November 13, 2009 4:46 PM
     
     
    Thank you for your detailed answer, Sean. Thanks for your answer too, Brian.

    @Microsoft: could you please reinvent this for us very importent function of sheduled moves at least for legacy Mailboxes in the exchange 2010 MC?

    I am not shure if where is enought time to move a complete Database in one Night and in our case the logfiles space isn't enought either for a complete Mailboxdatabase to move at once. A backup has to occur between to partial moves.

    So at the moment we have to sheduele about 100 boxes per night which I have to chose and put in a script which I could run by night which is much more work than the move between Exchange 5.5 and Exchange 2003 was.
  • Friday, November 13, 2009 5:11 PM
     
     
    Keep in mind this value add. Using task scheduler and powershell you don't have to worry about someone logging into a machine with remote desktop, kicking you off, and canceling all the moves. :)

    If you were on 2007 SP2 then as Sean mentioned you can "suspend" the moves for activation, this means almost all the data is moved from 2007 --> 2010, but it won't complete until you let the moves resume. At this last point in time the final delta of data is copied over and the user is flipped to the new mailbox server a'la Online Mailbox Moves. :) It is pretty slick when you get to see it happen, but being on 2003 you cannot take advantage of it.
    Brian Day, Overall Exchange & AD Geek
    MCSA 2000/2003, CCNA
    MCTS: Microsoft Exchange Server 2010 Configuration
    LMNOP
  • Wednesday, November 18, 2009 11:13 AM
     
     

    Hi Sean
    I tried to use your exampel, i only changed the database names. And i have tried to run your script without change and i recive the same error.
    After "database2" should this cmdlet be direct connected '; Connect-ExchangeServer -auto"  like: "database2"'; Connect-ExchangeServer -auto"

    Or what have i done wrong?


    Magnus
  • Wednesday, November 18, 2009 3:33 PM
     
     
    Magnus,

    My apologies, I had a line break within the command and it was not formatted correctly.  I have since edited my original post, I changed the command being called in the batch file to the following which should now work:

    PowerShell.exe -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; 'C:\Program Files\Microsoft\Exchange Server\V14\Scripts\MoveMailbox.ps1 -MailboxDatabase database1 -TargetDatabase database2'

    I have tested in my test environment and it does indeed move all mailboxes from the source mailbox to the target mailbox.  Let me know your results.
    Sean | http://seanv.wordpress.com
  • Monday, November 23, 2009 1:25 PM
     
     
    Hi Sean
    Thank you for your response, i tried but it does not move. My source database is called "store 4" so i modified your script and put situation chatacters around it but nothing happened.

    Best regards
    Magnus
    Magnus
  • Thursday, November 26, 2009 4:30 PM
     
     
    Magnus,

    As your source database is Exchange 2003, you are going to need to specify the server and storage group name (only Exchange 2010 has moved the management of databases to the organization level).

    The movemailbox.ps1 portion of the script will be as follows:

    MoveMailbox.ps1 -MailboxDatabase Server\SG\store4 -TargetDatabase database2

    Just populate Server with your server name and SG with your storage group name.
    Sean | http://seanv.wordpress.com
  • Tuesday, December 01, 2009 12:34 PM
     
     
    Interesteing: As I just saw: exact the funktionality I need was included in the Beta of Exchange 2010 - when I move a Mailbox to an other mailboxstore on one Server I get a Wizzard which allows to shedule the move.
  • Tuesday, December 01, 2009 2:14 PM
     
     
    That was probably before the new mailbox move processes were completed. What is it you do not like about using a scheduled task? It is actually more likely to not be interrupted that way than using EMC.
    Brian Day, Overall Exchange & AD Geek
    MCSA 2000/2003, CCNA
    MCTS: Microsoft Exchange Server 2010 Configuration
    LMNOP
  • Thursday, December 03, 2009 8:01 PM
     
     
    @Brian:

    Well, its mutch easier to select the mailboxes in the GUI of Exchange 2003 than exporting them to a scritp.

    In the GUI you select a group of Boxes and in the same view you can check how big these boxes are and estimate how much time the move will take. After selecting, the wizzard shows the selected group and one can be shure the boxes you selected are moved. Moving Mailboxes from 5.5 to 2003 this way worked so well, that we would have liked to enjoy the same "moving-fuction" in the next move we have to do (to 2010). So I think its a pitty to be back in the "command" time.
  • Wednesday, December 16, 2009 6:41 AM
     
     
    @testrrrr

    I can guarantee you that if you learn to effectively script, you can complete any task faster than you could by using any GUI.  Even the best designed GUIs take more time.

    In this case, there are several ways of getting the list of mailboxes and scheduling the moves.  You could export them from command line or have them ready to go in a CSV file.  The great thing about scripting is that once you have written your script, the next time around it is even faster to execute, because you simply call the script in one command.  If you really wanted to do something elaborate, you could even have your script go through the list of mailboxes to determine the mailbox sizes and produce you a report detailing the sizes and/or totals to estimate the length of the mailboxes moves.

    Regardless, the question of GUI versus CLI has always been an argument amongst computer users.  I personally believe that both are required as people have preferences upon how they do things.  Furthermore, a CLI interface might be powerful for the experienced scripter, it is counter-intuitive and keeps the novice from wanting to learn.  The GUI when designed well, can be very intuitive, friendly and easy to learn.
    Sean | http://seanv.wordpress.com
  • Wednesday, December 16, 2009 8:04 PM
     
     
    If you want to move a single mailbox with the MoveMailbox script, then use the following:

    MoveMailbox.ps1 -Identity "mailbox" -TargetDatabase "database"

    If you want to move all mailboxes in a database, then use the following:

    MoveMailbox.ps1 -MailboxDatabase "database1" -TargetDatabase "database2"

    What would you do if you were moving across domain forests? My situation; I have a win 2k domain with a exch2k3 on it. I just got some new win2k8 R2 machines up and running with a completly new domain and on a completely different forest and running exch2010. my question is how would I contact the mailbox database on the exchange2k3 machine?

    thanks, nik
  • Thursday, December 17, 2009 6:06 AM
     
     
    Nik,

    MoveMailbox.ps1 does not support cross-forest moves.  You cannot schedule these moves at present time.  However, it is possible to still perform these mailbox moves and you could go as far as batching them together, executing the request in a suspended mode and then you simply have to run a single command to start the moves.

    Be sure to prepare your environment to support the moves: http://technet.microsoft.com/en-us/library/ee633491.aspx

    Then when you are ready to actually perform the moves: http://technet.microsoft.com/en-us/library/dd876952.aspx

    Let me know if you need additional help after reading those two articles.
    Sean | http://seanv.wordpress.com
  • Thursday, December 17, 2009 12:24 PM
     
     

    Yea, I've tried those aswell. They don't seem to work for me. I often get errors such as these:



    [PS] C:\Windows\system32>New-MoveRequest -Identity 'test@domain.com' -RemoteLegacy -TargetDatabase 'Mailbox Database 00000001' -RemoteGlobalCatalog 'gc.olddomain.com' -RemoteCredential $Cred -TargetDeliveryDomain 'exch.newdomain.com'

    You must use the RemoteTargetDatabase parameter for remote push move requests.
        + CategoryInfo          : InvalidArgument: (test@domain.com:MailboxOrMailUserIdParameter) [New-MoveRequest], RecipientTaskException
        + FullyQualifiedErrorId : 1361A896,Microsoft.Exchange.Management.RecipientTasks.NewMoveRequest



    So I did what is said and used the "RemoteTargetDatabase" tag and got this while the target database is offline (dismounted):



    [PS] C:\Windows\system32>New-MoveRequest -Identity 'test@domain.com' -RemoteLegacy -RemoteTargetDatabase 'Mailbox Database 00000001' -RemoteGlobalCatalog 'gc.olddomain.com' -RemoteCredential $Cred -TargetDeliveryDomain 'exch.newdomain.com'

    Failed to communicate with the mailbox database.
        + CategoryInfo          : ResourceUnavailable: (0:Int32) [New-MoveRequest], ConnectionFailedTransientException
        + FullyQualifiedErrorId : 519D7209,Microsoft.Exchange.Management.RecipientTasks.NewMoveRequest



    And while the target database is online (mounted):



    [PS] C:\Windows\system32>New-MoveRequest -Identity 'test@domain.com' -RemoteLegacy -RemoteTargetDatabase 'Mailbox Database 00000001' -RemoteGlobalCatalog 'gc.olddomain.com' -RemoteCredential $Cred -TargetDeliveryDomain 'exch.newdomain.com'

    Service 'net.tcp://exch.newdomain.com/Microsoft.Exchange.MailboxReplicationService' encountered an exception. Error: An Active Directory error 0x51 occurred when trying to check the suitability of server gc.olddomain.com'. Error: 'Active directory response: The LDAP server is unavailable.'
        + CategoryInfo          : NotSpecified: (0:Int32) [New-MoveRequest], MailboxReplicationTransientException
        + FullyQualifiedErrorId : FC26E3E3,Microsoft.Exchange.Management.RecipientTasks.NewMoveRequest

  • Saturday, December 19, 2009 10:37 AM
     
     Proposed Answer
    Hi this is how to get it working:

    PowerShell.exe -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto;.  'C:\Program Files\Microsoft\Exchange Server\V14\Scripts\MoveMailbox.ps1' -MailboxDatabase database1 -TargetDatabase database2

     /Magnus


    Magnus
    • Proposed As Answer by M_gnus Saturday, December 19, 2009 10:38 AM
    •  
  • Thursday, February 04, 2010 6:01 PM
     
     
    You cannot move a mailbox from Exchange 2003 to Exchange 2010 using the Exchange 2003 System Manager.  You must perform your move using the cmdlets in Exchange 2010.  That being said there is no direct option to schedule a mailbox move with the cmdlets, the most you can do is prepare the move request and suspend it for later activation.  However, you could make use of task scheduler and MoveMailbox.ps1 script to queue up mailbox moves to occur at the time you decided to kick off your script.

    If you want to move a single mailbox with the MoveMailbox script, then use the following:

    MoveMailbox.ps1 -Identity "mailbox" -TargetDatabase "database"

    If you want to move all mailboxes in a database, then use the following:

    MoveMailbox.ps1 -MailboxDatabase "database1" -TargetDatabase "database2"

    You have to make sure that whichever command you use above, that you call via the following:

    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\scripts\movemailbox.ps1'; Connect-ExchangeServer -auto"

    Personally, I would place the above inside a batch file and call the batch file with the task scheduler.  So, for example to move all mailboxes from one database to another at 2:00 AM, place the following in a batch file called C:\mailboxmoves.bat:

    @ECHO OFF
    PowerShell.exe -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; 'C:\Program Files\Microsoft\Exchange Server\V14\Scripts\MoveMailbox.ps1 -MailboxDatabase database1 -TargetDatabase database2'

    To create the schedule taks via command line, do the following:
    schtasks /create /tn "MoveMailboxes" /tr "c:\mailboxmoves.bat" /sc once /st 02:00:00 /ru System

    and of course, make sure you perform all the above in an Elevated command prompt!
    Sean | http://seanv.wordpress.com

    Question.  Sorry if this seems simple, but I am new to scripting.  What if I wanted to use the above batch file, but import a .csv file with the mailboxes I wanted to move.  What would my batch file look like?
  • Thursday, January 27, 2011 12:07 AM
     
     

    This batch file didn't work for me.  It would start the Exchange PowerShell, but then just echo the movemailbox.ps1 command and then return to the command prompt.  The reason this happens is because you need to use PowerShell's invocation operator, &, to execute the quoted string as a command.  If you just use quotes it doesn't think you intend to execute a command.  That's why it just echoes your command string to the screen.

    Look toward the bottom of this article to see the explaination where I learned this from:

    http://www.windowsitpro.com/article/windows-powershell/running-powershell-scripts-is-as-easy-as-1-2-3/2.aspx

  • Thursday, January 27, 2011 12:09 AM
     
     

    Oh, so an example would be nice:

    PowerShell.exe -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; & 'C:\Program Files\Microsoft\Exchange Server\V14\Scripts\MoveMailbox.ps1' -Identity howard.goble -TargetDatabase MBDB1

    This one works for me, I cut and pasted it straight out of a working batchfile.  Of course it all goes on one long line.

  • Thursday, January 27, 2011 12:47 AM
     
     

    One final glitch I ran into was the command line provided to create the scheduled task:

    schtasks /create /tn "MoveMailboxes" /tr "c:\mailboxmoves.bat" /sc once /st 02:00:00 /ru System

    You can see that System is supposed to run the task.  This didn't work for me.  When I ran the task under the System account it would just stay running forever and do nothing.  I had to run it with a user account that had permission to run the script to make it work.  In this case it was a domain admin account.  You might want to create a service account to run these.  That's what I'm going to do.

  • Thursday, January 27, 2011 4:30 AM
     
     
    excellant info all.  I too am in the same boat here, want to be able to schedule moves to happen overnight whilst i am asleep, used to do this with the GUI with 2003 which was great, wish they would restore this function to Ex 2010, but will have to fall back on scripts and scheduled tasks to get this to happen now.
    Stew
  • Tuesday, May 01, 2012 2:40 PM
     
     

    If you are looking for a product to simplify these migrations I would recommend taking a look at the E2E Complete solution from Binary Tree which automates these tasks mentioned from an easy to use User Interface.

    More details can be found at the following location:

    http://www.binarytree.com/Products/Migrate/E2E-Complete.aspx