Monday, November 3, 2008

How do I use EXMERGE to delete specific messages from Exchange 2000/2003 mailboxes?

How do I use EXMERGE to delete specific messages from Exchange 2000/2003 mailboxes?

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.

Daniel Petri's Exchange Server Recommendations

If you just read my article but are looking for more comprehensive training, then Exchange Server 2007 training videos from Train Signal are just what you need. Not only are they taught by an MVP and MCSE, but they also cover topics like:

  • Installation of Exchange Server 2007
  • Introduction to PowerShell
  • Integration of Outlook Web Access
  • Mail Hygiene
  • Configuring Backup

Their "Hands-on" approach will take you through the steps you need to master Exchange Server 2007. Click here to check it out!

Daniel Petri

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.
  • Exchange 2000 (v6.0.4400) ( 528 kb) - This is the older E2K Resource Kit version. It's best that you obtain the version that came with Exchange 2000 Service Pack 3 (v6.0.6249 - Get it from HERE if you must).
  • Exchange Server 2003 (v6.5.7082) (423 kb) - (You can also get it from HERE if you must).

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:

  1. Navigate to the %Program Files%\Exchsrvr\bin folder of your Exchange server and double-click EXMERGE.EXE.
  2. On the Welcome page click Next.

  1. On the “Procedure Selection” dialogue box, select “Export or Import (Two Step Procedure)”.

  1. On the “Two Step Procedure” dialogue box, select “Step 1: Extract data from and Exchange Server Mailbox”.

  1. 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.

  1. Click “Options” where you'll configure the additional required information.
  2. On the “Data” tab select “User Messages and Folders”.
  3. On the “Import Procedure” tab select “Archive Data To Target Store”. This is the procedure that will delete the message from the selected mailboxes.

  1. 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.

  1. 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)

  1. 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

  1. 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.

Click Next.

  1. 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.

Click Next.

  1. 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.

Click Next.

  1. 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.

Click Next.

  1. 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.

  1. 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.

  1. 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).


Cleaning up

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.

Related articles

You might also want to read the following related articles:

Recent Exchange Forum threads

Got a question? Post it on our Exchange Server Forums!

No comments: