使用此脚本可以搜索Microsoft Exchange 2007的邮箱数据库中最小的邮箱。
#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}