17.13. Purging a Deleted Mailbox

Problem

You want to purge a deleted mailbox from the Exchange Store.

Solution

Using a graphical user interface

  1. Open the Exchange System Manager (ESM) snap-in.

  2. In the left pane, browse to the mailboxes container of the server, storage group, and database where you want to purge a mailbox.

  3. In the left pane, scroll down until you find the mailbox that you wish to purge. The mailbox should have a small red circle with a white X in it, indicating it is disconnected.

  4. Right-click the mailbox and select Purge.

  5. When prompted if you are sure you want to continue, click Yes.

Using VBScript

' This code purges a deleted mailbox.
' ------ SCRIPT CONFIGURATION ------
strComputer = "<Exchange Server>" 'e.g., ExchServer2
strMailbox = "<Mailbox Alias>"    'e.g., jsmith
' ------ END CONFIGURATION ---------
   
set objWMI = GetObject("winmgmts:\\" & strComputer & _
                       "\root\MicrosoftExchangeV2")
set objDiscMbx = objWMI.ExecQuery("Select * from Exchange_Mailbox WHERE " _
                              & "MailboxDisplayName='" & strMailbox & "'",,48)
for each objMbx in objDiscMbx
  objMbx.Purge
next
Wscript.Echo "Successfully purged mailbox."

Discussion

A mailbox that has been deleted still has physical presence in the Exchange store. This recipe wipes that mailbox completely from the store. Once a mailbox has been purged, the only way to retrieve it is through restoring from a backup, which could be a lengthy process given the need to recover the entire store. In other words, don't do this unless you are sure of the ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.