30 May 2012

Distribute mailboxes around databases in Exchange 2010

Exchange 2010 has a functionality, that allows you to distribute mailboxes around databases. This example script frees up the (old) database and spreads mailboxes to other mailbox databases:

$mdb = Get-MailboxDatabase mailbox*
$mdb | Set-MailboxDatabase -IsExcludedFromProvisioning $true
Get-Mailbox -Database $mdb | New-MoveRequest -SuspendWhenReadyToComplete

First command gets the database object into $mdb variable. Second command excludes the (old) database from being used in optimization process. Third line get’s all mailboxes located on old mailbox database and moves them to best suitable database (it happens when you don’t specify the exact target database). Suspend option will pause the move in the very last phase on moving process – so this command can be executed even on business hours. On Exchange 2010 the move-request is a background process and consumes very little resources. When all move requests are at 95% (state: automatically suspended), then you can execute the command:

Get-MoveRequest | Resume-MoveRequest

This command should be executed on off-hours.

No comments:

Post a Comment