MSI SQL Tool

The MSI SQL tool is a command line program that will help you manipulate existing MSI databases. This tool was introduced to help modify minor things after processing in the MSI Wrapper.

Usage

MSI SQL Tool 7.0.8.0 (experimental version)
Copyright (c) 2015 - EXEMSI.COM
License key: XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX-F53CD6

DESCRIPTION:

This program runs queries against the MSI database.

USAGE:

  MsiSql.exe [PARAMETERS]

Parameter         Description
----------------- -------------------------------------------------------------
msi               File name of the MSI to modify.
query             SQL query to run.


EXAMPLE:

MsiSql.exe msi="test.msi" query="INSERT INTO `Property` (`Property`, `Value`) VALUES ('TESTPROP', 'TESTVALUE')"


EXIT CODES:

0 = Success
1 = Error

Example

The following command lines were used to enable downgrading of a program wrapped by MSI Wrapper.

MsiSql.exe msi="Inno Dummy\Output\setup.msi" 
query="DELETE FROM LaunchCondition"
MsiSql.exe msi="Inno Dummy\Output\setup.msi"
query="DELETE FROM Upgrade WHERE ActionProperty='WIX_DOWNGRADE_DETECTED'"
MsiSql.exe msi="Inno Dummy\Output\setup.msi"
query="INSERT INTO Upgrade (UpgradeCode,VersionMin,Attributes,ActionProperty) VALUES ('{213D4F40-D9B0-42F9-96ED-E725768E7CB6}','2.0.0.0',4,'WIX_DOWNGRADE_DETECTED')"
MsiSql.exe msi="Inno Dummy\Output\setup.msi"
query="UPDATE Property SET Value=' ' WHERE Property='BZ.FIXED_INSTALL_ARGUMENTS'"

Support

Let me know if you are stuck!

Creating, testing, and debugging MSI packages can be a complex matter. Even though I have worked with the technology quite a lot, I am in no way an expert on the matter. However, I am willing to offer my help and maybe we can figure out what the problem is if we help each other.

In case you are stuck, you should start out by reading the documentation on Troubleshooting. If that does not help you, the next step will be to collect some information for me. You can use the contact form to start an email correspondence with me.

Here is what I need to help

Please help me help you by collecting as much information about the problem as possible. Here are some examples:

  • Description of the problem.
  • Screenshots of the problem.
  • Your configuration file for the MSI Wrapper.
  • Your MSI package.
  • The installer you are trying to wrap.
  • A log file from the installation.
  • Command line used to build the MSI if you are running the MSI Wrapper from a command line or build script.

Luckily most users of the MSI Wrapper are tech-savvy, which helps a lot when it comes to locating the problems. I also want to point out that some executable installers simply are not suitable for wrapping.

Batch build example

This small example will show you how to build an MSI from the command line.

Download example 

Wrapping vs. Repackaging

When it comes to creating an MSI package from an EXE, there are basically two different strategies you can choose from.

You can keep your EXE installer intact and wrap it in an MSI package. This is what the MSI Wrapper does. Alternatively, you can use a program that can record system changes and play them back. That is called repackaging.

Wrapping an Installer

When wrapping an installer, you put an MSI file around that installer. The original EXE installer is preserved in its original state. This also means that all the logic inside that installer is maintained. Having an MSI enables you to push that installation to other machines using Group Policy Objects (GPO) under Active Directory.

Repackaging

The technique behind repacking is that you start a program that will monitor and record system changes while it is running. Then you run the original EXE installer to the finish and stop the recording. All the recorded changes to the files system and registry are then written to an MSI file. Running the MSI on another machine will then replay these changes on that system.

Pros and Cons

The main advantage of wrapping compared to repackaging is that all computers are different in some way or another. Often the installers contain logic that make different decisions based on the state on the system where they are installed. This logic is lost in the repacking process where as the wrapping maintains that logic. Repacking is mostly used when the target system are very similar or the repackaged installers are extremely simple. Otherwise, wrapping is the preferred way.

One can argue that wrapping does not create "real" MSI packages. This is true in the sense that MSI installations were designed to be transactional. However, once the MSI packages contains scripting or other custom actions they often loose that ability anyway. Wrapping the EXE in such a way that it keeps its ability to uninstall and upgrade will often create a better result.

The MSI Wrapper was built because repackaging did not do the trick and there were no existing wrappers on the market that supported basic things such as uninstallation and upgrades.

Subcategories