Microsoft Exchange 2007 Permantly Delete Mailbox

When you delete a mailbox in Exchange Server 2007 using the Exchange Management Console or the remove-mailbox command in Exchange Management Shell the mailbox remains on the server for a specified period of time.

You can get all the disconected mailboxes by using the following command on Exchange Management Shell:

Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid

This command displays the name of the user and the GUID of the mailbox so you can use it in order to delete it.

To remove a single mailbox you can use the this command:
Remove-Mailbox -Database <Database-Name> -StoreMailboxIdentity <MailboxGuid> -confirm:$false

You can delete all the disconected mailboxes with this command:
Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName, MailboxGuid, Database | ForEach { Remove-Mailbox -Database $_.Database -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }

Be very carefull when it comes to permantly removing mailboxes becuase there is no other way to recover but using backup software...

Popular posts from this blog

Domain Controller Machine Password Reset

Managing Active Directory User Certificates using PowerShell

Configuring a Certificate on Exchange Receive Connector