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

Common MSI Conditions

Common MSI Conditions

Summary

This article provides some of the most common conditions used in MSI projects for custom actions, features, components, etc.

Synopsis

This article gives you some of the most common conditions used in MSI projects for custom actions, features, components, etc. It also serves as a quick reference for most of what you need to know about Conditional Statement Syntax.

Discussion

Common Conditions
SequencingCondition
First-time installationNot Installed
UninstallationREMOVE~="ALL"
AutoRepairREINSTALLMODE=pocmus
Uninstallation from Major UpgradeUPGRADINGPRODUCTCODE
Minor Upgrade via Setup.exeIS_MINOR_UPGRADE
Minor Upgrade via command lineREINSTALL~="ALL" And REINSTALLMODE><"v"
PatchPATCH
Patch UninstallationMSIPATCHREMOVE
ModifyInstalled And Not REINSTALL And Not REMOVE~="ALL"
Repair from ARPREINSTALL~="ALL" And REINSTALLMODE="ocmusv"
Repair from right-click of MSIREINSTALL~="ALL" And REINSTALLMODE="pecms"
Repair from Maintenance dialogREINSTALL And REINSTALLMODE="omus"
MaintenanceInstalled And Not RESUME And Not Preselected And Not PATCH
64 bit OSVersionNT64
32 bit OSNot VersionNT64
Running from Admin ImageIsAdminPackage
Silent Install (UI Sequence not run)UILevel <= 3
Install running from UNC PathSourceDir >< "\\"
Windows XPVersionNT = 501
Windows XP (64-bit)VersionNT64 = 502 And MsiNTProductType = 1
Windows Server 2003VersionNT = 502 And MsiNTProductType = 3
Windows Vista/Server 2008VersionNT = 600
Windows 7/Server 2008 R2VersionNT = 601
Windows 8/Server 2012VersionNT = 602
Windows 8.1 & 10/Server 2012 R2 & 2016VersionNT = 603
Feature installing or installed&FeatName = 3 Or (&FeatName <> 2 And !FeatName=3)
Component Reinstalling?ComponentName=$ComponentName
At least 2 GB of RAMPhysicalMemory >= 2048
MSI running with elevated privilegesMsiRunningElevated
Core OS Language is EnglishSystemLanguageID = 1033

Prefix/State Operators
OperatorMeaning
$ComponentNameComponent action state
?ComponentNameComponent install state
&FeatureNameFeature action state
!FeatureNameFeature install state
%EnvVarEnvironment variable value

State Values
StateValue
INSTALLSTATE_UNKNOWN-1
INSTALLSTATE_ADVERTISED1
INSTALLSTATE_ABSENT2
INSTALLSTATE_LOCAL3
INSTALLSTATE_SOURCE4

Substring Operators
OperatorMeaning
><Contains
<<Starts with
>>Ends with

Bitwise Operators
OperatorMeaning
><Bitwise contains (any bits in common)
<<Bitwise starts with (high 16 bits)
>>bitwise ends with (low 16 bits

Logical Operators
OperatorMeaning
NotInverts state of following item
AndTRUE if both terms are TRUE
OrTRUE if either or both terms are TRUE
XorTRUE if either but not both are TRUE
EqvTRUE if both are TRUE or both are FALSE
ImpTRUE if left term is FALSE or right is TRUE

Comparison Operators
OperatorMeaning
=Equals
<>Not equals
>Greater than
>=Greater than or equals
<Less than
<=Less than or equals
~=Case-insensitive equals

Additional Information

For more information on built-in Windows Installer Properties, please see the MSDN article Property Reference.
These charts are also available as a PDF.
Labels (1)
Was this article helpful? Yes No
No ratings
Version history
Last update:
‎Jun 09, 2018 02:09 AM
Updated by: