Executing Script Code Only During Uninstallation or Only During Installation

InstallShield 2023

Project:This information applies to the following project types:

InstallScript
InstallScript MSI

The installation script is executed during uninstallation and maintenance installations if MaintenanceStart rather than DeinstallStart is called to enable uninstallation. (In an event-based script, MaintenanceStart is called in the default OnMoveData event handler code.) To execute code only during uninstallation or maintenance installations, enclose it in the following if-then statement:

   if MAINTENANCE then

       /* this code is executed only during

       uninstallation or maintenance installations */

   endif;

To execute code only during a first installation, enclose it in the following if-then statement:

   if !MAINTENANCE then

       /* this code is executed only during

       a first installation */

   endif;

If code is not enclosed in either if-then statement, it is executed during uninstallation, maintenance installations, and first installations—with the following exceptions in event-based scripts:

The code in the following event handlers is executed only during uninstallation and maintenance installations:

OnMaintUIBefore

OnMaintUIAfter

The code in the following event handlers is executed only during the first installation:

OnCCPSearch

OnAppSearch

OnFirstUIBefore

OnFirstUIAfter