Extracting files from merge module

Brent Arias picture Brent Arias · Apr 23, 2010 · Viewed 19.6k times · Source

All I want is a command-line tool that can extract files from a merge module (.msm) onto disk. Said differently, I want the same "administrative install" functionality that is possible for an MSI:

msiexec /a myProduct.msi TARGETDIR="C:\myInstallation" /qn

The above only works on an msi (near as I can tell). So to get the same effect for a merge module, I'm trying msidb.exe and orca.exe The documentation for orca states:

Many merge module options can be specified from the command line...

Extracting Files from a Merge Module

Orca supports three different methods for extracting files contained in a merge module. Orca can extract the individual CAB file, extract the files into a module tree and extract the files into a source image once it has been merged into a target database...

Extracting Files

To extract the individual files from a merge module, use the

... -x ... option on the command line, where is the desired path to the new directory tree.

The specified path is used as the root path for the extracted files. All files are extracted from the CAB file embedded in the module and placed in the specified path. The directory layout for the extracted files is based on the directory tree of the merge module.

It sounds like what I need. But when I try it, orca simply opens up an editor (with info on the msm I specified) and then does nothing. I've tried a variety of command lines, usually starting with this:

orca -x theDirectory theModule.msm

I use "theDirectory" as whatever empty folder I want. Like I said - it didn't do anything.

Then I tried msidb, where a couple of attempts I've made look like this:

msidb -d theModule.msm -w {storage}

msidb -d theModule.msm -x MergeModule.CABinet

In the first case, I don't know what to put for {storage}. In the second case, it turns out that the literal string "MergeModule.CABinet" is necessary (it is a reserved name). However, the extracted cabinet does not preserve the file hierarchy or "normal" file names; so I can't use it for my purposes.

Can someone explain what I'm doing wrong with the command line options? Is there any other tool that can do this?

Answer

BryanJ picture BryanJ · Jul 27, 2012

You can use the decompiler tool included with WiX (called Dark) to decompile the merge module and extract the files:

dark.exe myMergeModule.msm -x "path_to_extracted_files"

The files will get extraced to the path specified in the -x parameter.

Note: The files will get extracted using the names specified in the File table of the installation database, which may not actually be the file names used when the files actually get installed. If you need extract the files using the actual file names, see my other answer to this question: Extracting files from merge module