How to Purge or Delete a Disconnected Mailbox in Exchange 2007

As many of you may have noticed, deleting a disconnected mailbox in Exchange Server 2007 is not as evident as it could be. Microsoft definitely wants to prevent accidental deletion of data, so it decided not to offer the option though the Exchange Management Console anymore. Purging a deleted or disconnected mailbox in exchange 2007 must now be done inputing a series of command in the Exchange Management Shell. There are many guides on the web that teach you how to do this, but they all involve a series of commands; commands which, depending on your settings, you will have to greatly modify to get them to work. In the following tutorial I will describe how to do it literally just by copying and pasting commands. You will have to make minimal modifications if any at all.

For those of you that do not know, a disconnected mailbox is nothing more than a deleted mailbox. When a mailbox is deleted in Exchange, it does not really get erased; it goes into a sort of “waste basket” for deleted mailboxes, called “disconnected mailboxes”.

Viewing Disconnected Mailboxes

1) Open “Exchange Management Console“.
2) On the left hand side column, expand “Recipient Configuration“.
3) Click on “Disconnected Mailbox“.
4) Disconnected mailboxes will show in the middle column.

Note: After deletion, the disconnected mailbox will still show up on the exchange management console. To make sure it has actually been deleted, the management console must be closed and opened again.

The Exchange Management Shell

Open the Exchange Management Shell by clicking on “Start“, “All Programs“, “Microsoft Exchange Server 2007” and click on “Exchange Management Console“.

 

Deleting All Disconnected Mailboxes at Once

In order to delete all disconnected mailboxes at once, issue the following two commands in your shell prompt:

$users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid
$users | ForEach { Remove-Mailbox -Database "Mailbox Database" -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }


Deleting Individual Disconnected Mailboxes

In order to delete an individual mailbox, we will have to adjust the command to reflect the name of the database and the user’s guid we want to delete.

Get the Database Name

To obtain the name of the database, issue the following command in the Exchange Management Shell:

get-mailboxdatabase

Get the User’s Guid

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

Erasing the User’s Disconnected Mailbox

Insert database name and user’s guid into the following command line and press enter (I have highlighted in red the parts to be replaced):

Remove-Mailbox -Database <Database-Name> -StoreMailboxIdentity <MailboxGuid> -confirm:$false

Note: If your database name is made-up of two separate words, write it exactly the same but enclose the word within apostrophes. For example, if your database name is Mailbox Database, enter it as ‘Mailbox Database’.

That’s all, I hope you find this tutorial useful. If you have any questions, do not hesitate to ask.

No comments yet.

Write a comment:


You will receive an email when your comment is answered

Time limit is exhausted. Please reload the CAPTCHA.

.