Moving Mailboxes with a script (Full Version)

All Forums >> [Microsoft Exchange 2007] >> Management



Message


datadog -> Moving Mailboxes with a script (14.Apr.2008 3:16:05 PM)

Has anyone created a script to call the move-mailbox command.  I need to run these mailbox moves at night but without leaving the command window open.
I would like to run the moves via scheduled tasks.  Anyone done something like this?

Thanks.




jveldh -> RE: Moving Mailboxes with a script (15.Apr.2008 4:17:34 PM)

Datadog,

Here's a script what moves the mailboxes using a Powershell script

If you want to move mailboxes:
Get-Mailbox -Database "First Storage Group\DB01"|Move-Mailbox -TargetDatabase
"servername\first storage group\mailbox database"

or if you want to specify which mailboxes you move
Move-Mailbox domain\user -TargetDatabase
"First Storage Group\Mailbox Database"
You can use a few extra parameters:
-SourceMailboxCleanupOptions DeleteSourceMailbox to cleanup
the source mailbox

-BadItemLimit 5 if more then 5 bad items are found in a mailbox
the move will not continue

Save the script as a ps1 file

Then create a schedule which runs a batch file with the following content:

Powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\Bin\ExShell.psc1" -Command ". 'c:\Program Files\Microsoft\Exchange Server\Scripts\NameofScript.ps1'"

And schedule to run at the time you want.




SteveJHU -> RE: Moving Mailboxes with a script (25.Jun.2008 11:46:25 AM)

In Exchange 2003, multiple mailboxes could be moved simultaneously using the GUI.  Has anyone figured out how to move multiple mailboxes simultaneously in 2007 (I remember moving four at a time in 2003)?
Thanks,
Steve




jveldh -> RE: Moving Mailboxes with a script (30.Jul.2008 2:53:12 AM)

Steve.

The script will do it automaticly and allows up to 4 streams I thought.




TXB2 -> RE: Moving Mailboxes with a script (31.Jul.2008 8:24:35 PM)

Steve,
You can still do it in the GUI in 2007. Highlight multiple mailboxes, right button, move mailboxes. It's 4 at time by default but I seem to remember that it is configurable.. 




Page: [1]