Submitted By: Adam Smith

Finds the Microsoft Exchange 2007 database with the fewest mailboxes, then uses information retrieved from a text file to enable mailboxes in that database. Thanks to Nick Smith (http://msexchangeteam.com/archive/2007/02/21/435561.aspx) for the portion of the script that finds the database.

PowerShell
Edit|Remove
#Change "ServerName" and Path to filename

$DB = (Get-Mailbox -server "ServerName" -ResultSize:Unlimited | Group-Object -Property:Database | 
Sort-Object -Property:Count | Select-Object -Property:Name)[0]

Import-Csv c:\scripts\newMBX.csv | foreach {enable-mailbox -Identity $_.alias -Alias $_.alias -Database $DB.Name}