Package MSP Files into an MSI File

Many Windows application installers come as standard MSI files.  MSIs are extremely easy to work with particularly when it comes to installing, uninstalling, and upgrading.  A related file type is MSP which is similar to MSI except that it only contains a specific application patch rather than the entire working application.  Sometimes multiple MSPs will exist as upgrades to an MSI and must be installed in order.

Applying MSP patches is easy through CMD.  If the base application already exists on the system, you can use MSIEXEC.EXE to patch it with an MSP:

MSIEXEC /P <MSPFileName>.msp REINSTALL=ALL REINSTALLMODE=omus

You can also apply an MSP at the same time that you install its parent MSI:

MSIEXEC /I <MSIFileName>.msi PATCH=<MSPFileName>.msp

But sometimes it may be easier to have all MSP patches included within a single MSI file.

This is something I’ve done before with applications such as Adobe Reader that frequently release updates as MSPs.  So let’s use that as an example.  Here are my MSI and MSP files for Adobe Reader stored at C:\Temp:

ReaderMSI&MSP

In order to encompass this MSP into the MSI, we must first do an administrative install of the MSI.  Do this and define a new folder for the admin install to use with the following command:

MSIEXEC /A "<MSIFileName>.msi" TARGETDIR="C:\TempInstall"

Note: Remember to utilize quotation marks “” if the MSI name or target directory path have spaces in them.

So my specific command to do the admin install in C:\TempInstall ends up being:

MSItoMSP1

Proceed with the install wizard if one pops up.

After that completes, we can open the new folder C:\TempInstall that our admin install created to see that it includes all the Adobe Reader program files as well as a new copy of our MSI:

MSItoMSP2

We’ll need this specific MSI for the next command.  We then patch this administrative install with our MSP using:

MSIEXEC /A <NewMSIFileName>.msi /P <MSPFileName>.msp TARGETDIR=C:\TempInstall /QB

So my specific command to patch the Adobe Reader admin install is:

MSItoMSP3.png

Now that we have the admin install patched, we must package everything back into a new MSI.  We utilize a script called WiMakCab.VBS which is part of the Windows SDK Components for Windows Installer Developers.  You may need to download and install Windows SDK.

For Windows 10, download from here: https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk

For Windows 7, download from here: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=3138

Once you have Windows SDK installed, open a command prompt and change directories to where the SDK program files store WiMakCab.VBS.

The default directory for Windows 10 x64 is: C:\Program Files (x86)\Windows Kits\10\bin\x86

The default directory for Windows 7 x64 is: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1\Samples\sysmgmt\msi\scripts

Once in the appropriate directory, use WiMakCab.VBS to package the MSI with the following command:

WiMakCab.vbs <NewMSIFileName>.msi TempCAB /R /L /C /U /E /S

TempCAB will be the name of the temporary CAB file that is generated.  You can name it whatever you want, it won’t matter.

So my commands are:

MSItoMSP4

A CAB warning message may pop up, you can close and ignore it.  A second command prompt should then open that displays the progress of the MSI packaging.  The process may take a few minutes to complete.

Once finished, we can open up the admin install folder at C:\TempInstall to see that the MSI located there has increased in size because it now contains the patch information from the MSP:

MSItoMSP5.png

You can now use this MSI to install the application and it will include the patch updates.  There is no need to save the other admin install files.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: