Detecting First-Time Installations, Maintenance Mode, and Uninstallation

InstallShield 2019

Your installation can determine whether the installation is being run for the first time on a target system.

Windows Installer–Based Projects

In the Windows Installer sequences, the following conditions detect certain types of installation:

First-time installation: Not Installed
Maintenance: Installed
Uninstallation: REMOVE="ALL" (after the InstallValidate action)

You can use these conditions in any of the Condition settings of a Basic MSI or InstallScript MSI project.

InstallScript-Based Projects

In InstallScript, the MAINTENANCE variable is FALSE for a first-time installation, and TRUE for maintenance mode or uninstallation. Therefore, you can use an if-statement like the following for any code you want to run only for a first-time installation.

if (!MAINTENANCE) then

    // code to run for first-time installation

endif;

You can use that sort of code in event-driven InstallScript code of InstallScript and InstallScript MSI projects.

See Also