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

 From: 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 -StoreMailboxIdentity -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 }

你可能感兴趣的:(Exchange,Server,exchange,server,database,null)