What is Windows Installer – Tutorial 2

Windows Installer Features and Components

Features and components are the 2 main organisational sets used in a windows installer to categorize all software data installation data such as files, registry, components, shortcuts, INI, xml and file type association information.

Feature component View

 

Features

MSI authors use features to divide application features into separate containers for the most part to provide easy to use and flexible end user customisation as features contain smarts to allow this both from the GUI or via a command line, within these containers an MSI author will place single or multiple components.

Features also use a system of Parent and child association, providing greater ability to sub categorise components into further subsections. The feature also relies off an installation level system that determines wether it is marked for action during any installation phase. Features can be marked as hidden or visible in muli-feature configurations

 

Components

A component contains the application specific file, Registry, shortcut, INI. XMLfile and file type association data as well as a lot more. Components enable an MSI author to also use built in smarts of the windows installer service to automatically determine installation, repair and uninstall actions of the content within using conditioning. Components are also used by authors to create a 64bit MSI package to contain 64 bit and 32 bit components in the same installer package should the software being delivered require it.

 

An application packager needs to be very well versed in their knowledge of the capabilities and limitations of the components to not only enable them to themselves apply complex customisations to vendor MSI’s but to also troubleshooting other application packager packages as well as vendors packages which return errors upon installation, repair and uninstallation    

Windows installer features

Windows Installer Features Description
Elevated Installation capability Application are installed via a windows service. This means application can be installed whilst non administrative users are logged on by leveraging the service account.
Open file format Installers can be designed by the vendor and opened or edited by the client. This makes the installer very flexible.
Self-Healing / Self repair Applications are automatically fixed when files or registry are missing or corrupt. This feature allows support costs to be reduced dramatically
User profile fix up Operating systems that support more than one user profile will repair any new user accounts after the initial application delivery. (this is every OS after 95)
Scriptable object model Windows Installer files and repository can be scripted and queried.
Reference counting

Application Sociability

Multiple applications can share files or registry, these shared items will remain intact after uninstall of a shared product.
Transactional Installation All changes to the system are recorded in the order of execution. In the event of failure the entire installation can be rolled back including reinstalling any applications removed as part of the installation. (i.e. in an upgrade scenario)
Silent installation All installations can easily remove the GUI component of the installation allowing installations to delivered silently without user input required.
Advertised Installation Applications can appear to be installed to the user, applications will never be installed unless the user accesses the application.
Patching support Applications can be patched using a number of patching methods such as cumulative, iterative.
Application chaining Multiple applications making up a solution can be chained together.
Upgrades Applications can be upgraded from one version to another. This may require a full or partial uninstall of the previous product prior to installing the new version.

 

Windows Installer Mechanism

There are 3 main phases to a successful installation and repair process these are the User Interface, and Execution. For unsuccessful installation the Rollback phase is the third phase.

 

User Interface

At the beginning of the User Interface phase, an application or a user instructs the installer to install a feature or an application. The installer then progresses through the actions specified in the sequence tables of the installation database. These actions query the installation database and generate a script that gives a step-by-step procedure for performing the installation.

 

Execution

During the execution phase, the installer passes the information to a process with elevated privileges and runs the script.

 

Rollback

An installation is unsuccessful, the installer restores the original state of the computer. When the installer processes the installation script it simultaneously generates a rollback script. In addition to the rollback script, the installer saves a copy of every file it deletes during the installation. These files are kept in a hidden, system directory. Once the installation is complete, the rollback script and the saved files are deleted.

Windows Installer Component Management

Windows Installer reduces the total cost of ownership (TCO) of applications by increasing the ability of your customers to manage and maintain application components during setup and run time. The installation database tracks which applications require a particular component, which files comprise each component, where each file is installed on the system, and where component sources are located. This allows vendor developers to author packages that provide the following benefits:

  • Increased resiliency of applications. Use the installer to detect and reinstall damaged components without having to rerun setup. The installer checks the path of a component at run time. This frees applications from dependency on static file paths which commonly differ between computers and can point to missing components.
  • Installation-On-Demand. This feature set is not installed during setup but is specified in the database to be installed just-in-time for use if required by the application in the future. Users do not need to rerun setup. For more information.
  • Advertisement of shortcuts to features, applications, or entire products in the user interface. Users can install these on-demand by using the shortcuts. Users can also remove features, applications, or entire products on-demand.
  • Installation customization. An administrator can apply transforms to the database that tailor the installation for a particular group of users.
  • Easier deployment of application updates. Use the installer to update your products. For more information.
  • Feature shortcut display. The installer displays shortcuts to features that run locally with shortcuts to features that run remotely. Because the installation database specifies the run context of each feature, visibly equivalent entry points can be presented to users as needed.
  • Keep usage metrics on features. Vendor developers can provide an installation package that keeps usage count of a feature by all client applications and removes components that are not being used.

Incorporate installations. Vendor developers can incorporate the component management capabilities of the installer into their applications by authoring an installation package and by using the Installer Functions in their application code. The following figure illustrates an application requesting the installation of a feature.

 

Windows Installer Command Line options

The executable program that interprets packages and installs products is Msiexec.exe. Note that Msiexec also sets an error level on return that corresponds to system error codes. Command-line options are case-insensitive.

 

Option Parameters Meaning
/I Package|ProductCode Installs or configures a product.
/f [p|o|e|d|c|a|u|m|s|v] Package|ProductCode Repairs a product. This option ignores any property values entered on the command line. The default argument list for this option is ‘omus.’ This option shares the same argument list as the REINSTALLMODE property.

p – Reinstalls only if file is missing.

o – Reinstalls if file is missing or an older version is installed.

e – Reinstalls if file is missing or an equal or older version is installed.

d – Reinstalls if file is missing or a different version is installed.

c – Reinstalls if file is missing or the stored checksum does not match the calculated value. Only repairs files that have msidbFileAttributesChecksum in the Attributes column of the File table.

a – Forces all files to be reinstalled.

u – Rewrites all required user-specific registry entries.

m – Rewrites all required computer-specific registry entries.

s – Overwrites all existing shortcuts.

v – Runs from source and re-caches the local package. Do not use the v reinstall option for the first installation of an application or feature.

/a Package Administrative installation option. Installs a product on the network.
/x Package|ProductCode Uninstalls a product.
/j [u|m]Package

or

[u|m]Package/tTransform List

or

[u|m]Package/gLanguageID

Advertises a product. This option ignores any property values entered on the command line.

u – Advertises to the current user.

m – Advertises to all users of machine.

g – Language identifier.

t – Applies transform to advertised package.

/L [i|w|e|a|r|u|c|m|o|p|v|x|+|!|*] Logfile Writes logging information into a logfile at the specified existing path. The path to the logfile location must already exist. The installer does not create the directory structure for the logfile. Flags indicate which information to log. If no flags are specified, the default is ‘iwearmo.’

i – Status messages.

w – Nonfatal warnings.

e – All error messages.

a – Start up of actions.

r – Action-specific records.

u – User requests.

c – Initial UI parameters.

m – Out-of-memory or fatal exit information.

o – Out-of-disk-space messages.

p – Terminal properties.

v – Verbose output.

x – Extra debugging information.

Windows Installer 2.0:  Not supported. The x option is available with Windows Installer version 3.0.3790.2180 and later.

+ – Append to existing file.

! – Flush each line to the log.

“*” – Wildcard, log all information except for the v and x options. To include the v and x options, specify “/l*vx”.

Note  For more information about all the methods that are available for setting the logging mode.

/m filename

Note  The length of filename must be no more than eight characters.

Generates an SMS status .mif file. Must be used with either the install (-i), remove (-x), administrative installation (-a), or reinstall (-f) options. The ISMIF32.DLL is installed as part of SMS and must be on the path.

The fields of the status mif file are filled with the following information:

Manufacturer – Author

Product – Revision Number

Version – Subject

Locale – Template

Serial Number – not set

Installation – set by ISMIF32.DLL to “DateTime”

InstallStatus – “Success” or “Failed”

Description – Error messages in the following order: 1) Error messages generated by installer. 2) Resource from Msi.dll if installation could not commence or user exit. 3) System error message file. 4) Formatted message: “Installer error %i”, where %i is error returned from Msi.dll.

/p PatchPackage[;patchPackage2…] Applies a patch. To apply a patch to an installed administrative image you must combine the following options:

/p <PatchPackage>[;patchPackage2…] /a <Package>

/q n|b|r|f Sets user interface level.

q , qn – No UI

qb – Basic UI. Use qb! to hide the Cancel button.

qr – Reduced UI with no modal dialog box displayed at the end of the installation.

qf – Full UI and any authored Fatal Error, UserExit, or Exit modal dialog boxes at the end.

qn+ – No UI except for a modal dialog box displayed at the end.

qb+ – Basic UI with a modal dialog box displayed at the end. The modal box is not displayed if the user cancels the installation. Use qb+! or qb!+ to hide the Cancel button.

qb- – Basic UI with no modal dialog boxes. Please note that /qb+- is not a supported UI level. Use qb-! or qb!- to hide the Cancel button.

Note that the ! option is available with Windows Installer 2.0 and works only with basic UI. It is not valid with full UI.

/? or /h Displays copyright information for Windows Installer.
/y module Calls the system function DllRegisterServer to self-register modules passed in on the command line. Specify the full path to the DLL. For example, for MY_FILE.DLL in the current folder you can use:

msiexec /y .\MY_FILE.DLL

This option is only used for registry information that cannot be added using the registry tables of the .msi file.

/z module Calls the system function DllUnRegisterServer to unregister modules passed in on the command line. Specify the full path to the DLL. For example, for MY_FILE.DLL in the current folder you can use:

msiexec /z .\MY_FILE.DLL

This option is only used for registry information that cannot be removed using the registry tables of the .msi file.

 

 

The options /i, /x, /f[p|o|e|d|c|a|u|m|s|v], /j[u|m], /a, /p, /y and /z should not be used together. The one exception to this rule is that patching an administrative installation requires using both /p and /a. The options /t, /c and /g should only be used with /j. The options /l and /q can be used with /i, /x, /f[p|o|e|d|c|a|u|m|s|v], /j[u|m], /a, and /p. The option /n can be used with /i, /f, /x and /p.

To install a product from A:\Example.msi, install the product as follows:

msiexec /i A:\Example.msi

 

Only public properties can be modified using the command line. All property names on the command line are interpreted as uppercase but the value retains case sensitivity. If you enter MyProperty at a command line, the installer overrides the value of MYPROPERTY and not the value of MyProperty in the Property table. For more information

 

To install a product with PROPERTY set to VALUE, use the following syntax on the command line. You can put the property anywhere except between an option and its argument.

 

Correct syntax:

msiexec /i A:\Example.msi PROPERTY=VALUE

Incorrect syntax:

msiexec /i PROPERTY=VALUE A:\Example.msi

 

Property values that are literal strings must be enclosed in quotation marks. Include any white spaces in the string between the marks.

msiexec /i A:\Example.msi PROPERTY=”Embedded White Space”

 

To clear a public property by using the command line, set its value to an empty string.

msiexec /i A:\Example.msi PROPERTY=””

 

For sections of text set apart by literal quotation marks, enclose the section with a second pair of quotation marks.

msiexec /i A:\Example.msi PROPERTY=”Embedded “”Quotes”” White Space”

 

The following example shows a complicated command line.

msiexec /i testdb.msi INSTALLLEVEL=3 /l*v msi.log COMPANYNAME=”Acme “”Widgets”” and “”Gizmos.”””

 

The following example shows advertisement options. Note that switches are not case-sensitive.

msiexec /JM msisample.msi /T transform.mst /L*VIME logfile.txt

 

The following example shows you how to install a new instance of a product to be advertised. This product is authored to support multiple instance transforms.

msiexec /JM msisample.msi /T :instance1.mst;customization.mst /c /L*VIME logfile.txt

 

The following example shows how to patch an instance of a product that is installed using multiple instance transforms.

msiexec /p msipatch.msp;msipatch2.msp /n {00000001-0002-0000-0000-624474736554} /qb

 

When you apply patches to a specific product, the /i and /p options cannot be specified together in a command line. In this case, you can apply patches to a product as follows.

msiexec /i A:\Example.msi PATCH=msipatch.msp;msipatch2.msp /qb

 

The PATCH property cannot be set in a command line, when /p option is used. If the PATCH property is set when the /p option is used, the value of PATCH property is ignored and overwritten.

 

Do you want to know the “3 common vendor installer types?  then check out more in our next tutorial

“What is Windows Installer – Tutorial 1”

” Understanding Vendor Installers – Tutorial 1″

New to Application Packaging, check out some more of our online tutorials.

Author: Geoffrey Regalado

With career spanning over 10 years specialising as an Application Delivery Systems and Application Packaging engineer, I have worked on various enterprise projects as a technical lead and consultant. As a specialist trainer in MSI, application virtualisation and layering technologies i am also a tech evangelist in the field.

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *