cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Conditions to Determine Installation States

Conditions to Determine Installation States

Summary

This article includes a list of common conditions that are used to determine the state of an installation.

Synopsis

Instead of using an explicit script, Basic MSI setups determine the actions to perform and the order in which they will occur using sequence tables. In particular, the InstallUISequence and InstallExecuteSequence tables?the "User Interface" and "Execute" sequences?contain ordered lists of actions to perform during a normal installation (that is, an installation started by double-clicking an MSI database icon or by running the command msiexec /i ProductName.msi).

When working with the MSI sequence tables, an important idea is that the same sequences are used for first-time installations and maintenance installations (including uninstallation); there is no separate "uninstallation sequence". Therefore, any custom actions you schedule in the Installation sequences will by default run for both installation and uninstallation. The problem, of course, is that this behavior is undesirable for many custom actions, especially those involving launching or manipulating files installed by your installation.

Discussion

To ensure that an action runs only during a desired time, you can condition the custom action. The following table includes some of the more common conditions that can be used to ensure that the custom action only runs during the installation state that is desired. Keep in mind that property names are case-sensitive. Also, silent and UI-limited installations will only perform actions in the Execute sequence.
Installation StateConditionNotes
First time InstallNot InstalledInstalled is true if a product with the same product code is found on the machine. This will evaluate to true for major upgrades as well.
Modify, Repair, or RemoveInstalled
Remove (Uninstall)
REMOVE="ALL"this condition is valid only after the InstallValidate action in the InstallExecuteSequence table. For detecting an uninstall during the UI sequence, you can use _IsMaintenance="Remove" anywhere after the MaintenanceType dialog box?
Maintenance or RepairInstalled AND Not REMOVE
Minor UpgradeIS_MINOR_UPGRADEset by the setup.exe launcher
Major UpgradeIS_MAJOR_UPGRADEset by the action ISSetAllUsers
Major UpgradeActionPropertyThe property specified as the Detect Property in the Advanced tab of the Major Upgrade item.
In addition to detecting different types of installation for the entire product, it can sometimes be useful to detect if a specific feature or component is being installed or removed. To support this, Windows Installer defines feature/component action and feature/component state with a special syntax. Action conditions enable you to determine if a feature's installation state is changing (in the example above, from "not installed" to "installed locally"). If you want to determine a feature or component's state, regardless of whether the state is changing, you can use state conditions. Feature/component action is defined as &FeatureName=n and $ComponentName=n respectively while feature/component state is respectively defined as !FeatureName=n and ?ComponentName=n where n corresponds to the number in the table below:
-1No action (feature unchanged)
1Feature advertised
2Feature not installed (uninstalled)
3Feature installed locally
4Feature installed to run from source

Additional Information

For more information on creating conditions please refer to the MSDN article Conditional Statement Syntax.

For more information on the ActionProperty please refer to the MSDN article Upgrade Table.

For more information on the Installed property, please refer to the MSDN article Installed Property

For more information on the REMOVE property, please refer to the MSDN article REMOVE Property

Was this article helpful? Yes No
No ratings
Version history
Last update:
‎Nov 07, 2007 06:36 PM
Updated by: