MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Unattended MSI Builds using ANT[Next]: Create a MSI Transform
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Building or Updating MSIs->Repackaging - Converting an EXE to MSI

Repackaging - Converting an EXE to MSI

Sometimes you need to wrap a third party (legacy) installer up as an MSI to simplify distribution issues or to alter the way it installs. You probably have an "exe" file and ideally you want to run an "exe2msi" command (if only it were that simple!).

The most difficult part of the whole process is not the actual creation of the MSI, this is in fact generally a relatively simple process! The hard part is identifying the information anyone would require to automate the install using any technology including batch files. This is what you'd generally need to know:

  1. How to silently install the installer EXE you wish to "wrap". A "/s" (or "/q") command line switch is common. You may also want to pass parameters such as installation directory (not always possible to alter these). Now I normally go the "extra mile" and look for logging switches so that if the install/uninstall fails, the problem can be diagnosed.

  2. How to silently uninstall the product installed in step 1 above. Again I look for logging options. Examining the "uninstall" registry may help, except this is generally not silent (generally prompts for confirmation).

If the installer is MSI based (see below for how to tell) then you will almost always wish to create a transform, the product's documentation is likely to cover options (properties or features etc), even if its only for the "MSIEXEC.EXE" command line.

Knowing the installer tool used for its packaging can help if the 3rd party product (or its support staff) won't or can't provide it (you'd have to wonder about their limited capabilities though...). This is because the tool's documentation or FAQ will frequently describe how this is done.

Once the install and uninstall steps are known and tested it is simply a matter of building the mechanism into the MSI (frequently using the "WrapInstall" command to fill in the parameters).

Type of Repackaging

These are the main approaches in order of preference (my opinion):

  1. Create MSI Transform (for MSI based installers)
  2. Wrap Existing Installers
  3. Recreate Setup
  4. Setup Capture
  5. Setup Automation

Which Approach is Best for a Particular Installer? How I decide...

The following assumes you do wish to end up with an installable product which has a ".msi" file extension. If this is not the case some of the reasons you may be considering repackaging can be solved by generating a bootstrapper EXE which may install any number of products (MSI based or not) in sequence.

  1. Look at the vendor's website as well as any readme files associated with the product for silent (unmanned/unattended) installation instructions. Maybe its as simple as following these instructions. For example Adobe Acrobat Reader is now MSI based and can be "tuned" with a tool they supply (and no, I haven't tried it)... Hopefully you will at least get some information on what public properties you might need to adjust and what features select/deselect.

  2. Is the product MSI based (either has a ".msi" file extension or is an MSI wrapped in a ".exe")? See the section below for how to tell... If it is MSI based then I create a transform.

    You should realise that a severe limitation of Windows Installers is that only a single install can occur at any one time. This is why the "wrap existing installers" approach can't be used for MSI based installers... Windows Installer still supports "nested installs" but this approach is not recommended (and is depreciated).

  3. The following steps only apply to EXE based installers which don't imbed an MSI.

  4. Try to identify the type of install tool to build the EXE or find documentation which describes its command line. You need to determine whether you can silently (and reliably) install and uninstall the product. If so see the "wrap existing installers" section, I highly recommend you at least consider the need to use a tool like "RunProcess.EXE" to automatically terminate processes which may have hung.

  5. If you can't reliably install/uninstall the product then if its simple enough then recreating the setup is relatively easy. This can be the best way if you also wish to include a lot of configuration or company programs or scripts.

  6. If you get here you're probably going to try setup capture or setup automation.

Is an EXE Installer Wrapping an MSI? If so how to extract the MSI?

You can try the Universal Extractor tool to try to extract the files, if it succeeds and it extracted an MSI then you know!

Otherwise start a normal manual installation of the product (leave it sitting at the "welcome" dialog) and then use process explorer to look at recently started processes. If it always installs unattended you may have only a short period of time, open a command prompt and get a command prompt ready to invoke "PsSuspend.exe" on "MSIEXEC.EXE" and when you see "MSIEXEC.EXE" being start with process explorer, immediately switch to the command prompt and press enter, now you have as much time as you need (use the commands "-r" switch to resume when finished).

If you don't see the EXE or you see some likely "MSIEXEC.EXE" command lines (check all such processes) then the product is MSI based (and the full location and name of the MSI will be visible in the command line).

Make a copy of this MSI file (probably in a "temp" directory) and any obviously related files then cancel the install.

Sometimes it is obvious what was used to package the product and most tools don't generate MSI files (NSIS for example).

Links to Repackaging/Unattended Operation Resources

Some external resources which may have specific information about the product you wish to repackage are:

Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Unattended MSI Builds using ANT[Next]: Create a MSI Transform

MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday May 28 2022 at 3:11pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.