Sometimes one might need to delete many messages from one or more mailboxes. This might happen when trying to stop someone from reading an e-mail message you‘ve sent by mistake (assuming he or she didn‘t open his or her mailbox yet), deleting an infected attachment or even removing an appointment that was sent to 100 people by mistake.
Deleting one message from one mailbox isn‘t a hard thing to accomplish, but deleting hundreds of specific messages from hundreds of mailboxes found on many Exchange servers is sure to give a good headache to any system administrator.
For example, let‘s say I‘ve sent a message titles “This is a test message” with the attachment 70-720.doc to another user, and I want to delete this message before that user opens his or her mailbox.
Luckily for us, we can utilize the power of EXMERGE to delete these messages (and they do not need to be e-mail messages. In fact you can use EXMERGE to remove and delete any kind of object found inside your mailbox folders).
First, you need to obtain the correct version of EXMERGE for your Exchange server. EXMERGE first shipped with the Exchange 5.5 Resource Kit and the most recent version can be obtained from the latest Exchange 2000 Service Pack (SP3) and Exchange Server 2003 installation CD.
- Exchange 5.5 (v3.3.10) (1.4 mb) – You need to extract and use the tool, don‘t mind the rest of the stuff in the zipped file, and do not mind the name of the file…
- Exchange Server 2000/2003 (v6.5.7082) (423 kb)
Note: To write this article I‘ve used Exchange Server 2003, Outlook 2003, and the latest version of EXMERGE, however the procedure is quite the same with previous versions.
After downloading the correct version of EXMERGE, extract the files found in it by using tools like WinZip or WinRAR. You will now need to copy EXMERGE.EXE to the %Program Files%\Exchsrvr\bin folder of your Exchange server.
Next, you need to configure your user account to have full mailbox rights for the specific mailbox/mailboxes that you want to open. On Exchange 2000/2003 the Exchange Full Administrator permissions does NOT, by default, allow you to open any other user‘s mailbox.
The above screenshot is an example of EXMERGE failure due to poorly configured permissions. Read Grant Full Mailbox Rights to an Administrator on Exchange 2000/2003 for more info.
How to use EXMERGE
To delete specific items from one or more mailboxes found on one Exchange server follow these steps:
- Navigate to the %Program Files%\Exchsrvr\bin folder of your Exchange server and double-click EXMERGE.EXE.
- On the Welcome page click Next.
- On the “Procedure Selection” dialogue box, select “Export or Import (Two Step Procedure)”.
- On the “Two Step Procedure” dialogue box, select “Step 1: Extract data from and Exchange Server Mailbox”.
- In the “Source Server” dialogue box specify the name of your Exchange server. If you have a multiple domain environment you‘ll need to specify the name and LDAP port number of your Domain Controller.
- Click “Options” where you‘ll configure the additional required information.
- On the “Data” tab select “User Messages and Folders”.
- On the “Import Procedure” tab select “Archive Data To Target Store”. This is the procedure that will delete the message from the selected mailboxes.
- You will be prompted with a dialogue box notifying you that this process will delete the message from the Information store once it has been copied to the PST file. Click Yes.
- You can specify which folders within the mailbox will be scanned and which folders will be ignored.
You can also select a time and date range for the scanning operation.
I left both options blank because I wanted to scan the entire mailbox and go through all dates (when in fact I could have selected just the inbox, thus making the process run faster)
- You can also specify what message to look for based upon the message title and/or any attachment found in that message. In our example I could have scanned any message containing the word “test”, and/or any message attachment containing the word “70-270”. Use your own parameters based upon your own needs.
Note: I advise to always enter the exact phrase you‘re looking for (if you know it) and select the “Exact String Match”, so that you do not delete any other messages by mistake.
When you‘re done click Ok to go back to the “Source Server” dialogue box. Click Next
- In the “Database Selection” dialogue box select the mailbox store you want to perform the action upon.
Note: In a scenario where you only have one mailbox store you will not be presented with this page.
- In the “Mailbox Selection” dialogue box select individual mailboxes or press the “Select All” button to select all mailboxes found in that store. In this example I will only select one mailbox. Note that you can also see the mailbox size next to the mailbox name.
- On the “Locale Selection” dialogue box select the Locale that you would like to use to search the mailboxes.
Hebrew users note: To successfully utilize the power of EXMERGE when using Hebrew enabled servers with Hebrew-titled items and mailbox names you MUST follow the next tip: EXMERGE and Hebrew Fonts. Failing to do so might cause great damage to your exported mailboxes and to the names and titles of items within those mailboxes. Failing to do so will not harm the items that are in the original mailboxes, however items that were exported to the .PST files might turn out to be illegible.
- Specify the path to the folder where you want to place the deleted items. This folder should reside on a different HD that the one where your mailbox stores are located, but this is only a recommendation for performance benefits, not a must. Also, make sure you have enough free space on that partition.
- On the “Save Settings” dialogue box you can now save the settings you‘ve configured so far, or you can just click Next. You can also chance the name and location of the files used by EXMERGE by clicking on the “File Names” button.
- The process will now begin. This could take a considerable about of time depending on how many mailboxes you‘ve selected and the size of the mailboxes.
Notice an example of a successful process:
If you get a window that states that there were one or more failures, such as this one:
then it‘s probably because of wrong permissions on the destination mailboxes. Re-read Grant Full Mailbox Rights to an Administrator on Exchange 2000/2003 and start from the beginning of the article.
- To test and see whether the message was in fact successfully deleted you can do one of two:
- Log-on as the destination user and open Outlook. See if the message is still there. It shouldn‘t be.
- Go to the folder where you‘ve stored the deleted item(s) – see step #15 – and open one of the .PST files found there. You can easily do so from within your own Outlook profile by going to File > Open > Outlook Data File. The resulting personal folder file should be totally empty and ONLY show the deleted item(s).
Don‘t forget to delete the folder where you‘ve stored the deleted item(s) – see step #15 – it‘s just taking up free space on your hard disk.
Note about PST Size
One of our Petri KB readers, Mark G, emailed me the following suggestion about PST size and I think it is a great addition to this article:
I use exmerge to archive and delete old emails from my various clients exchange servers. It’s been my experience that an unsuccessful copy is due to the resulting PST file exceeding its limits. The Exmerge utility saves exchange items to an ANSI format PST and therefore has a limit of 2GB in size or 16K items (16,384) per Microsoft Support KB 208480. Often the export will reach the limit of the number of items before its size limit is reached. Often due to the size of a MailBox account and the volume of email to be archived it is too large to be exported to a single PST. So I export the contents to a multiple PSTs, broken up by smaller date ranges.