An MSI loosely follows a relational database structure holding all of the installation parameters and settings including.
- Available features
- Relationship between features and components
- Necessary registry settings
- User interface for the application
This mini guide will introduce how to customise an MSI file to pre answer prompts during an installation and create a transform file MST. In this example we will be customising the IBM Lotus Notes 7.0.3 install to not install the feature “Client Single Logon” and to change the install directory and data directory. The same principals should apply to other MSI’s.
It is best practice to create MST files to hold configuration changes rather than changing the original MSI. A MST file acts as an extension to an MSI file, so the original MSI file never gets changed and you can have several MST files witch different settings for different purposes.
You can obviously buy software which will give you a GUI for making these changes however Microsoft have released a free tool as part of the Windows Installer SDK called Orca which allows you to go in and change data in the MSI database.
Installing and Running Orca
- To install and run the Orca editor, follow these steps:
- Download the Windows Installer SDK samples, tools, and documentation from the following Web page:
- Install the Orca editor by double-clicking the Orca.msi file in the \Microsoft SDK\bin folder.
- Click Start, point to Programs, and then click Orca.
- On the File menu, click Open, and then browse to the .msi file that you want to edit.
Creating a new MST File
Once you have opened the MSI with orca you should create a new MST so any changes you make will be stored separate to the MSI (best practice)
- Got the Transform menu
- Select New Transform
If you need to you can now go into the Transform menu and change the Transform Properties for things such as “Product version lower”
MSI Table Overview
The main tables to of interest are probably;
Feature: What features to install
Control: Holds everything to do with the installers interface
Property: Answers to prompts within the installer
Registry: Any changes to the registry
Shorcut: Any shortcuts created by the Application
Adding and Removing Features
Before going into the feature table we need to go into the property table and make a note of the value for the property INSTALLLEVEL, in my case it is 100 (normally the standard)
Now if we go into the feature table you should see there is a Level column, all features will a level value below or equal to INSTALLLEVEL will be set to install by default and all features will a value above will not by installed by default.
So if you want to change feature to be installed change the Level value to one equal or lover than INSTALLLEVEL or set it higher prevent it from being installed.
So using my example with Lotus Notes I am going to change the Level of the ClientSingleLogon feature from 101 to 1 so it does not get installed
Some things to watch out for here, items in the condition table can over ride these settings if the listed condition is meet then the Level is set to the one listed. An MSI author can define install level values that represent specific installation options, such as Custom, Typical, or Minimum
Changing the default Answer to Prompts
When setting the default value for a prompt we need to look at two tables, the Control table and the Property table.
If you open the Control table first, we are interested with the columns Dialog, Control and Property.
The Dialog column shows us the internal name of the current window during the install wizard, so this will give us a clue if we are in the right place
The Control column again will give us a clue we have found the correct control
The Property column is the really important one, you should notice that some controls have a property set and some do not. When the installer runs it will set the default value of the control to whatever is set for that property in the Property table
For example in my Lotus Notes MSI’s Control table I have a control called InstallPath with the Property value of DATADIR
If I look in the Property table I can see a record for DATADIR with a value of “C:\program files\lotus\notes\data”
So if I want to change the Lotus Notes data directory I just need to edit DATADIR in the Property table.
Sometimes you will find that a corresponding record does not exist in the Property table, if that happens you can just right-click in the table a select Add Row.
Note on Radio Buttons. If the control you want to set is a Radio Button then the value you need to enter in the Property table can be found the RadioButton table in the Value column.
Saving the Transform File (MST)
Once you have made your changes it is time to save.
- Open the Transform menu
- Select Generate Transform
- Select were to save the MST file
Making Further Changes to the MST File in Future
- Open the MSI file with Orca
- Go to the Transform Menu
- Select Apply Transform
- Find and open your transform
- Orca will highlight change to the original MSI
Running and MSI with a Transform file
Msiexec /i “<MSI path and file>” TRANSFORMS=”<MST path and file>”
More detailed information on the MSI Database
As always please comment if you need some assistance.