Using Mailbox Merge Wizard (ExMerge.exe) In Batch Mode With PsExec

2010-04-05 Updated
2010-03-30 Initial Post

The other week I was searching for information on how to run ExMerge with PsExec and couldn't find anything. I'm sure other admins have done that before but never posted info online about how they did it. I tested this out and using ExMerge with PsExec does work. I ended up not going through with this in production for non-technical reasons, but I know it works. Read the ExMerge and PsExec documentation for more info if you have any questions.


Mailbox Merge Wizard (ExMerge.exe) is a MS utility that can be used to extract and import Exchange server mailbox data. As of this writing, ExMerge v6.5.7529.0 was used. It can be downloaded from

PsExec is a MS utility that can be used to execute processes on a remote computer. As of this writing, PsExec v1.97 was used. It can be downloaded from

The procedure here will use a batch file to call PsExec and have it execute ExMerge, in batch mode, directly on each remote Exchange server. The idea behind this is that in environments with many Exchange servers in multiple geographic locations across a WAN, using only one server to run the ExMerge process against multiple servers would take much longer than if the ExMerge process were to run locally on each server.

This is a very specific procedure which uses ExMerge in archive mode to copy and then delete messages with a specific subject name. One reason for doing this would be if a user sent out an inappropriate message to many recipients and management would like the message deleted from the recipients’ mailboxes.

  • This was tested in an Exchange Server 2003 SP2 on Windows Server 2003 SP2 environment.
  • Note that PsExec needs to be installed on the computer running the batch file. It's extremely important that the path to \\FILE-SERV-1\ExMerge-Config\ExMerge.ini be accessible, otherwise the default ExMerge.ini on the remote Exchange server is used, which could have some unwanted consequences such as archiving e-mails that you din't want archived.
  • Makes sure that the account that you use to run this process has full mailbox access/receive as permission to all mailboxes.
  • The batch file runs the commands sequentially, so if you want to run ExMerge simultaneously on multiple servers, create batch files for each server or a smaller group of servers. I tried using the "start" batch command for each line but that didn't work.
  • You can use UNCs with ExMerge in batch mode. This is useful for pointing to a shared ExMerge.ini file with the -F switch, as I did in my example.
  • Note that an exported PST file of size 32 KB means that it’s empty, but PSTs of over 100 KB could also be empty because ExMerge exports each mailbox's entire folder hierarchy. Large folder hierarchies add to the size of the PST, even if all folders within are completely empty. I didn't see any option to disable this behavior.

Example ExMerge/PsExec Batch File

mode con: cols=150 lines=55
@Echo Off
Echo ****
Echo **** You are about to run ExMerge in batch mode.
Echo ****
CD C:\PsExec
@Echo On
psexec -u My-AD-Domain\ExAdmin -p SomeP@55w0rd \\EX-SERV-1 "D:\Program Files\Exchsrvr\bin\ExMerge.exe" -B -F \\FILE-SERV-1\ExMerge-Config\ExMerge.ini -srcserv EX-SERV-1
psexec -u My-AD-Domain\ExAdmin -p SomeP@55w0rd \\EX-SERV-2 "D:\Program Files\Exchsrvr\bin\ExMerge.exe" -B -F \\FILE-SERV-1\ExMerge-Config\ExMerge.ini -srcserv EX-SERV-2

Example ExMerge.ini File

; This file is for use with the EXMERGE.EXE program, version 4.00 or higher.

; #####
; Change date references to the current day. The date naming format is YYYY-MM-DD. The date is not used by ExMerge itself.
;  The date only serves as a reference for the sys admin to know which date the particular ExMerge ran.
; This is a customized ExMerge.ini file that is used to REMOVE a message with a specific string in the subject.
;  ALL user mailboxes on ALL storage groups and ALL mailbox stores will be processed.
;  The search string is found in the Subjects.txt file specified by FileContainingListOfMessageSubjects.
;  The search criteria used is sub-string match, ignore case.
;  ALL folders and subfolders will be searched and there is no date/time filter.
;  The output PST files will be stored in the path specified by DataDirectoryName.
; #####
; ##### Edit date in 1 line below. Folder must exist (I suggest using a root path to get around this). Log files are created on the system that's actually executing the ExMerge command.
; ##### Edit date in 1 line below. Folder will be created if it doesn't already exist. It's created on the system that's actually executing the ExMerge command.
; ##### For the line below, the source server name must be specified in batch mode, e.g., exmerge -B -F N:\exmerge.ini -srcserv Ex-Serv-1
; #### Edit the Subjects.txt file to add the subject string(s) to search for.

Tags: , , ,

Leave a Reply