Thursday, July 5, 2012

Exchange: Bulk Mailbox Database Migrations


AUTO SUSPEND

$targetDB="DATABASENAME"

$users = Import-Csv C:\Mailbox\Move.csv
foreach ($user in $users)
{
Write-Output "Processing User: $($user.UserName) at $(get-date)"
Get-Mailbox -Identity $user.UserName| New-MoveRequest -BatchName 'MyBatchName' -SuspendWhenReadyToComplete -TargetDatab5ase "$($targetDB)" -BadItemLimit 5
Write-Output "Finished Processing User: $($user.UserName) at $(get-date)"
}


NO SUSPEND
$targetDB="DATABASENAME"


$users = Import-Csv C:\Mailbox\Move.csv
foreach ($user in $users)
{
Write-Output "Processing User: $($user.UserName) at $(get-date)"
Get-Mailbox -Identity $user.UserName | New-MoveRequest -BatchName 'MyBatchName' -TargetDatabase "$($targetDB)" -BadItemLimit 5
Write-Output "Finished Processing User: $($user.UserName) at $(get-date)"
}


Some other helpful one liners to go with the previous scripts.

Get-MoveRequest -MoveStatus 'InProgress' -BatchName 'MyBatchName'
Get-MoveRequest -MoveStatus 'AutoSuspended' -BatchName 'MyBatchName'
Get-MoveRequest -MoveStatus 'CompletionInProgress' -BatchName 'MyBatchName'


Get-MoveRequest -MoveStatus 'AutoSuspended' -BatchName 'MyBatchName' | Resume-MoveRequest

No comments:

Post a Comment