MSI Silent Mode Installations for InstallScript MSI Projects

InstallShield 2013

Project: This information applies to InstallScript MSI projects.

If you need to silently install an InstallScript MSI project without using Setup.exe, you can use the MSI silent mode.

Launching MSI Silent Installations for InstallScript MSI Projects

The MSI silent installation is launched in the following cases:

The installation is launched at the command line by typing the following:

msiexec product.msi /qn

The installation is activated from an advertised shortcut.
The installation is activated from install-on-demand.
When the product is removed when an update package is running.

Unlike the traditional silent mode, the MSI silent mode does not follow the regular logic provided through script. It simply runs through the InstallExecuteSequence table. (To see this table, navigate to the Direct Editor.) As a result, some events are not called, including the following:

All UI installation events—OnFirstUIBefore and OnFirstUIAfter
All Feature events

The OnMsiSilentInstall Event

What the Event Does

In an InstallScript MSI–based installation, InstallShield runs the OnMsiSilentInstall event handler if the product is not already installed on the target system. This happens if the installation is activated from an advertised shortcut or if the installation is launched through the following command line:

msiexec product.msi /qn

You need to override the OnMsiSilentInstall event if you want to support the MSI silent installation mode. This allows you to perform tasks that are normally performed in the OnFirstUIBefore, OnFirstUIAfter, and feature event handlers.

Overriding the Event

By default, OnMsiSilentInstall displays a message and then aborts the installation. You can override this event handler by writing your own implementation of the function. The prototype of this function is as follows:

external prototype OnMsiSilentInstall(HWND hInstall);

 

where hInstall is the handle to the installation.

The simplest thing that you can do is to implement an empty body of this event so that the installation will not abort. For example:

function OnMsiSilentInstall(hInstall)

begin

  //Do nothing and allow installation to continue.

end;

Again, OnMsiSilentInstall will be called on MSI silent installation and on activation of an advertised shortcut. It will not be called on Install-On-Demand, auto-repair, and uninstall mode.

Detecting the Mode in which a Silent Installation is Running

To detect whether a traditional silent installation is running from InstallShield script, use the following:

if (MODE = SILENTMODE)

 

To detect whether an MSI silent mode installation (including /q, advertise, auto-repair, uninstall, or install-on-demand) is running from InstallShield script, check the Windows Installer property ISSETUP_UISEQUENCE_PROCESSED using the MsiGetProperty Windows Installer API function. If this property is not set, then it is a silent install. (It indicates that the InstallUISequence is not executed.)

See Also