Intelligent Message Filter, Content Filter, can do more...

WinDeveloper IMF Tune
WinDeveloper IMF Tune

Complete ExMerge Command-Line Control

Alexander Zammit

Alexander Zammit Photo

Software Development Consultant. Involved in the development of various Enterprise software solutions. Today focused on Blockchain and DLT technologies.

  • Published: Aug 15, 2006
  • Category: ExMerge
  • Votes: 4.7 out of 5 - 18 Votes
Cast your Vote
Poor Excellent

The command-line is the right interface to take full advantage of ExMerge. Here we combine it with ldifde.exe and exmergeini.exe to configure mailbox processing and facilitate batch process integration.

In Windows 200x systems you can extract these values from Active Directory. Specifically each user account object (linked to an Exchange mailbox) will have the property legacyExchangeDN holding the required value. You could use adsiedit (included with the Windows 200x support tools), to read this for individual users.

Another option is the ldifde.exe command-line tool. This application is installed on Windows 200x servers. It is very useful when importing/exporting objects from Active Directory. Here I will just show an example of how ldifde.exe could be used for this purpose.

ldifde.exe -v -f c:\temp\users.txt -r "(& (objectclass=user)(mailnickname=*))" -l legacyExchangeDN -d CN=users,DC=domain,DC=com

The above command processes user objects under CN=users,DC=domain,DC=com. The exported objects are required to match the condition (& (objectclass=user)(mailnickname=*)). This filter is meant to only include users having an Exchange mailbox. The amount of information exported for each user is kept to a minimum through the -l legacyExchangeDN parameter sequence. Finally the exported data is saved to c:\temp\users.txt.

Here is how users.txt looks like:

LDIFDE output

Setting INI File Configuration Options Through Command-Line

Another aspect of ExMerge that can pose a little challenge is the setting of INI file values on the fly. Let's say ExMerge is part of a batch process performing a brick level backup. The generated pst files are to be saved in a directory whose name is constructed based on the date.

Using the configuration INI file this can be done by setting the DataDirectoryName value. However editing INI file values automatically is not that simple. For this purpose, I built a little application ExMergeIni.exe to do just that. Get your copy from the downloads section. For those having some programming background, this application boils down to calling the Win32 WritePrivateProfileString function.

With this application you can set any of the INI file values. Here is an example:

ExMergeIni.exe DataDirectoryName c:\ExMerge\Brick -f c:\ExMerge\Config.ini

The first parameter identifies the configuration setting name whereas the second identifies its value. The optional -f switch allows for specifying the path to the INI configuration file. For complete details on how to use the application just run it with no parameters.

ExMergeIni.exe Help

Finally here is a little batch file example showing ExMergeIni.exe and ExMerge.exe in use together. This batch file takes one parameter specifying the path where the exported mailboxes and log files are to be saved. The script does include some hard-coded paths, but this is just for illustration purposes.

echo OFF
echo =================
echo = Backup Script =
echo =================
echo -
echo - Base Backup Destination Path: %1
if NOT EXIST %1 ( echo - FAILED: Invalid destination path. 
goto end )

echo ON

md %1\Exchange
md %1\Exchange\Brick 
md %1\Exchange\logs

C:\Backups\Script\ExMergeIni.exe DataDirectoryName %1\Exchange\Brick 
-f C:\Backups\Script\ExMerge.ini

C:\Backups\Script\ExMergeIni.exe LogFileName %1\Exchange\logs\ExMerge.log 
-f C:\Backups\Script\ExMerge.ini

"C:\Program Files\Exchsrvr\bin\ExMerge.exe" -b -f C:\Backups\Script\ExMerge.ini

echo OFF


Final Tips

Arguably the most useful interface exposed by ExMerge is the command-line. Through ldifde.exe, mailbox DNs may be retrieved to populate its list of mailboxes. ExMergeIni.exe facilitates batch processing, allowing the automatic adjustment of INI settings as necessary.


Meeting the ExMerge Requirements

ExMerge Download - Tools for Exchange Server 2003

Copyright © 2005 - 2024 All rights reserved. is not affiliated with Microsoft Corporation