Moving mailboxes using EMS - only moves one mailbox at a time
I am trying to move a bunch ofmailboxes from one DB to another. In the past I used EMC and scheduled it to start during the night and set it to cancel the task after 7 hours. This worked great except for our Blackberry users. I guess when a mailbox is moved from one DB to another the Balckberry server loses it's link to themailbox and users start to call in complaing they are not getting emails on thair BB. The only fix is to restart the BB server or resart some services in a certian order.To remidy the problem we created a command that would move the mailboxes then when finished it restarted the necessary services on the BBserver and sceduled it to run in schedules tasks. see command below:MoveUserDB.cmdpowershell -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -command "& 'C:\tasks\MoveUserDB.ps1' "psexec \\BBServer c:\tasks\restart_services.cmd -u domain\username -p "password"MoveUserDB.PS1Import-CSV C:\Tasks\move.csv | ForEach {Get-Mailbox $_.Alias | Move-Mailbox -TargetDatabase $_.TargetDB -PreserveMailboxSizeLimit:$true -MaxThreads 4 -RetryInterval 7:00 -Confirm:$False} It works but only moves one mailbox at a time. My question is how can I get it to move more than 1 mailbox at a time? I thought the default was 4?Eric
June 4th, 2009 7:03pm

It is because Import-CSV ...| ForEach... method get the result from CSV file one by one and pipe it to move-mailbox as multiple cmdlet one by one... You need to build a logic to get the result from Get-Mailbox filter instead of Import-CSV so it will allow you to Something like first use Import-CSV...| ForEach...Set-Mailbox to set some customattributeXX to some value, like "Move This". And in second line of script, move mailboxes something like with Get-Mailbox | Where{ $_.customattributeXX -eq "Move This"} | Move-Mailbox... In next line set the value of customattirbuteXX back to blankAmit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
June 4th, 2009 8:13pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics