您的位置:首页 > 大数据 > 人工智能

MS MVP的牛文 ---- Removing disconnected mailboxes in Exchange Server 2007

2008-11-21 15:58 471 查看
转载自:http://msmvps.com/blogs/andersonpatricio/archive/2007/10/08/removing-disconnected-mailboxes-in-exchange-server-2007.aspx

Exchange Server 2007 doesn't allow us to purge the disconnected mailbox. In order to remove one or multiple disconnected mailboxes we can be performing these steps:
Listing all disconnected mailboxes
Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid
Removing a single entry
Remove-Mailbox -Database <Database-Name> -StoreMailboxIdentity <MailboxGuid> -confirm:$false
Removing all users at the same time
$users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid

Now that we have all disconnected mailboxes in a var, we can run the following cmdlet to remove all of them:
$users | ForEach { Remove-Mailbox -Database "Mailbox Database" -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }

=================================================================================
Daniel said:
Just a little improvment to remove on all databases of the server:
$users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid,Database
$users | ForEach { Remove-Mailbox -Database $_.Database -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: