cancel
Showing results for 
Search instead for 
Did you mean: 

Determining if MSI Setup Was Launched from Setup.exe

Determining if MSI Setup Was Launched from Setup.exe

Summary

How to to determine whether the user launched your setup from the setup launcher or from the MSI database

Synopsis

In a Basic MSI project created with InstallShield, creation of the Setup.exe setup launcher is optional. If your build configuration is such that the MSI database is external to Setup.exe, and if the target system has the Windows Installer service present, a user can launch your MSI file directly to initiate the installation. (On the other hand, for an InstallScript MSI project, the setup launcher Setup.exe cannot be deselected in the Release Wizard.)

In some cases, however, you might want to be able to determine whether the user launched your setup from the setup launcher or from the MSI database.

Discussion

To do this, you can take advantage of the fact that you can define custom public properties at the command line. For example, running the following command creates a custom property called MYPROPERTY, which will be available for use (for example, in a condition) through the rest of the running installation:
msiexec /i product.msi MYPROPERTY=1

To determine if the installation was launched from Setup.exe, you can specify that Setup.exe should create a property at the command line when it is launched. You can then use the existence of this property to determine if the user launched your setup from the launcher.

To set up the custom property, select the desired release icon in the Releases view, and select the MSI Command Line Arguments property, entering:
USER_LAUNCHED_SETUPEXE=1

Inside your setup, the condition:
USER_LAUNCHED_SETUPEXE

will succeed if the user launched Setup.exe, and the condition:
Not USER_LAUNCHED_SETUPEXE

will succeed if the user ran your setup directly from the MSI database.

One additional concern, to handle per-user installations, is that you might want to add your custom property USER_LAUNCHED_SETUPEXE to the SecureCustomProperties property, in the Property Manager.