Hi,
We are currently beginning a transistion to Exchange 2010. We are also consolidating a number of Exchange Servers that are geographically dispersed and need to move account to the data centre. I have developed the following code that works moving accounts from a file.
Get-Content c:\ExchangeScripts\Migrate_Staff\staff.csv | Get-Mailbox | Move-Mailbox -TargetDatabase TASM-EXM8\TASMDB16 -Confirm:$false -MaxThreads 6 | out-file -append c:\ExchangeScripts\Migrate_Staff\migration.log
This works quite well however the previous version that could randomly select one of the eight Databases on two server and move the user to that DB. Below is that code.
$error.clear()
$File_Import = Import-CSV "c:\ExchangeScripts\Migrate_Staff\staff.csv"
$DB = ("TASM-EXM7\TASMDB10","TASM-EXM7\TASMDB11","TASM-EXM7\TASMDB12","TASM-EXM7\TASMDB13","TASM-EXM8\TASMDB14","TASM-EXM8\TASMDB15","TASM-EXM8\TASMDB16","TASM-EXM8\TASMDB17");
"-> Begine Processing"
foreach($_.Name in $File_import) {
"-> Processing User $_.Name"
$chosen_database = $DB | Get-Random;
Move-Mailbox -Identity $_.Name -TargetDatabase $chosen_database -MaxThreads 4 -Confirm:$false | out-file -append c:\ExchangeScripts\Migrate_Staff\migrate.log
}
$error | out-file c:\ExchangeScripts\Migrate_Staff\error.log
I know the answer is slapping me in the face but I just can't seem to get concurrent account moves going to random db's. Anyone got any ideas? Any help would be greatly appreciated.