- April 12, 2022
- Posted by: Pavithra
- Category: End User Computing
What are the Properties? (MSI Properties)
Windows Installer can configure software installation by using the values of variables defined in an installation package or by the user.
What are the types of Properties? (MSI Properties)
Windows Installer uses three categories of global variables during an installation:
- Private properties: The installer uses private properties internally and their values must be authored into the installation database or set to values determined by the operating environment.
- Public properties: Public properties can be authored into the database and changed by a user or system administrator on the command line, by applying a transform, or by interacting with an authored user interface.
- Restricted public properties: For security purposes, the author of an installation package can restrict the public properties a user can change.
Not all properties need to be defined in every package; there is a small set of required properties that must be defined in every package. The installer sets the values of properties in a particular order of precedence.
When the properties are used? (MSI Properties)
The logical value of a property that has been set is true. To determine whether a property is set without actually getting its value, test the logical expression “MyProperty” or “Not MyProperty”. When the property MyProperty is set, the former evaluates as True and the latter as False.
One or more properties can be combined with operators to form logical expressions used in a conditional statements
A conditional statement using properties can be entered into the Condition column of the Condition table to modify the selection state of any entry in the Feature table. Conditional statements with one or more properties are commonly used in the Condition column of database tables. The following tables each have a column for conditional expressions:
- Condition table
- ControlEvent table
- LaunchCondition table
- InstallUISequence table
- InstallExecuteSequence table
- ControlCondition table
- AdminExecuteSequence table
- AdvtExecuteSequence table
- AdminUISequence table
Note that the six action sequence tables have fields for a condition. If the conditional expression in this field evaluates to False, the installer skips that action.
Using a Directory Property in a Path
The directories in the Directory table specify the layout of an installation. When the Windows Installer resolves these directories during the CostFinalize action, the keys in the Directory table become properties set to directory paths. The installer also always sets a number of standard System Folder Properties to system folder paths. The values of the System Folder Properties are guaranteed to end in a directory separator. The values of all other properties entered in the Directory table are only guaranteed to end in a directory separator after the installer has run the CostFinalize action. Before costing has completed, the values of properties entered in the Directory table which are not System Folder Properties may not end in a directory separator. Therefore, if the installation sets directory properties using custom actions in the package, the values on reference might not end with a directory separator. Directory properties ending with a directory separator can therefore be used in a path string without explicitly including the directory separator. For example, if the value of DirectoryProperty ends with a directory separator, the following string correctly specifies the path to file in subdirectory
And the following path string is incorrect.
How to create or edit the properties? (MSI Properties)
To use properties in the installation, one can get and set property values from programs using MsiGetProperty and MsiSetProperty and include as part of conditional statements in the installation database.
- To obtain a current property, call the MsiGetProperty function.
- To obtain the current installation state, call the MsiGetMode function.
- To obtain the language for the current installation, call the MsiGetLanguage function.
- To set a property, call the MsiSetProperty function.
- To set the installation state, call the MsiSetMode function.
- To clear a property (setting it to Null), set the property’s value to an empty string: “”.
What is the difference between Public, Private and Restricted Properties? (MSI Properties)
Private properties are used internally by the installer and their values must be entered into the database by the author of the installation package or set by the installer during the installation to values determined by the operating environment. The only way a user can interact with private properties is through Control Events in the package’s authored user interface. Private property names must include lowercase letters. Private properties commonly describe the operating environment. For example, if the installation is run on a Windows platform, the installer sets the WindowsFolder property to the value specified in the Property table. Private property values cannot be overridden at a command line. To clear a private property from an installation, leave it out of the Property table. On Windows XP, Windows 2000, and Windows NT, one cannot set a private property in the user interface phase of the installation and then pass the value to the execution phase. On earlier systems, this is possible because the user interface and execution sequences run in the same process.
Public properties can be authored into the installation database in the same way as private properties. In addition, the values of public properties can be changed by a user or system administrator by setting the property on the command line, by applying a transform, or by interacting with an authored user interface. Public property names cannot contain lowercase letters. Public properties are commonly set by users during the installation. For example, the public property INSTALLLEVEL property can be specified at the command line used to launch the installation or chosen by using an authored user interface. Public property values can be overridden either at a command line, by using a standard or custom action, by applying a transform, or by having the user interact with an authored user interface. To clear a public property in the property table, leave it out of the table. Properties that are to be set by the user interface during the installation and then passed to the execution phase of the installation must be public. For a list of the standard public properties used by the installer see Property Reference. An author can also define a custom public property by entering the property’s name and an initial value into the Property table. All public properties can be overridden by all users if any of the following conditions are true.
- The system is Windows 95 or Windows 98.
- The user is a system administrator.
- The per-machine EnableUserControl policy is set to 1. See System Policy.
- The EnableUserControl property is set to 1.
- This is an unmanaged installation that is not being done with elevated privileges.
Restricted Public Properties
In the case of a managed installation, the package author may need to limit which public properties are passed to the server side and can be changed by a user that is not a system administrator. Some restrictions are commonly necessary to maintain a secure environment when the installation requires the installer to use elevated privileges. If all of the following conditions are met, a user that is not a system administrator can only overrides an approved list of restricted public properties:
- The system is Windows NT/Windows 2000.
- The user is not a system administrator.
- The application or product is being installed with elevated privileges.
If all of the above conditions are true, the installer defaults to the following list of restricted public properties that can be changed by any user:
The author of an installation package can extend this default list to include additional public properties by using the SecureCustomProperties property. Setting the EnableUserControl property or the EnableUserControl system policy extends the list to all public properties. All users can then change any public property. The installer sets the RestrictedUserControl property whenever the list of public properties passed to the server by non-administrator users is restricted.
What are the Required Properties? (MSI Properties)
There are five properties that are required for every installation.
Order of Property Precedence
The installer sets properties using the following order of precedence. A property value in this list can override a value that comes after it and be overridden by a value coming before it in the list.
- Properties specified by the operating environment.
- Public properties set on the command line.
- Public properties listed by the AdminProperties propertyset during an administrative installation.
- Public or private properties set during the application of a transform.
- Public or private property that set by authoring the Property table of the .msi file.
Restrictions on Property Names
All property names must follow these restrictions.
- A property name is an Identifier, which is a text string that must begin with either a letter or an underscore. Identifiers and property names may contain letters, numerals, underscores, or periods; but cannot begin with a numeral or period.
- Public property names cannot contain lowercase letters.
- Private property names must contain some lowercase letters.
- Property names prefixed with % represent system and user environment variables. These are never entered into the Property table. The permanent settings of environment variables can only be modified using the Environment Table.
Initialization of Property Values
It is recommended that all properties to be used by the installation be entered into the Property table with an initial value. The installer sets the properties to these values at the launch of the installation. Properties for which a blank is an acceptable value and properties built into the installer do not need to be initialized.