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