Exchange Server Forums

Forums | Register | Login | My Profile | Inbox | RSS RSS icon | My Subscription | My Forums | Address Book | Member List | Search | FAQ | Ticket List | Log Out

Moving Mailboxes with a script

Users viewing this topic: none

Logged in as: Guest
  Printable Version
All Forums >> [Microsoft Exchange 2007] >> Management >> Moving Mailboxes with a script Page: [1]
Login
Message << Older Topic   Newer Topic >>
Moving Mailboxes with a script - 14.Apr.2008 3:16:05 PM   
datadog

 

Posts: 3
Joined: 27.Mar.2008
Status: offline
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.
Post #: 1
RE: Moving Mailboxes with a script - 15.Apr.2008 4:17:34 PM   
jveldh

 

Posts: 551
Joined: 12.Apr.2008
From: The Netherlands
Status: offline
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.


< Message edited by jveldh -- 15.Apr.2008 4:20:12 PM >


_____________________________

Best regards,

Johan Veldhuis

Visit my website

(in reply to datadog)
Post #: 2
RE: Moving Mailboxes with a script - 25.Jun.2008 11:46:25 AM   
SteveJHU

 

Posts: 4
Joined: 27.May2008
Status: offline
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

(in reply to jveldh)
Post #: 3
RE: Moving Mailboxes with a script - 30.Jul.2008 2:53:12 AM   
jveldh

 

Posts: 551
Joined: 12.Apr.2008
From: The Netherlands
Status: offline
Steve.

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

_____________________________

Best regards,

Johan Veldhuis

Visit my website

(in reply to SteveJHU)
Post #: 4
RE: Moving Mailboxes with a script - 31.Jul.2008 8:24:35 PM   
TXB2

 

Posts: 53
Joined: 20.Mar.2008
Status: offline
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.. 

(in reply to jveldh)
Post #: 5

Page:   [1] << Older Topic    Newer Topic >>
All Forums >> [Microsoft Exchange 2007] >> Management >> Moving Mailboxes with a script Page: [1]
Jump to:

New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts