cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tcom36
Level 7

Determine install/uninstall in custom action

I am in an InstallScript MSI project. I have defined an installscript and a custom action which uses this script.

The script is called as well during installing as during uninstall. The behaviour of the script would need to be different depending on (un)install.

How do I check within such a script if he feature is being installed or uninstalled?
Labels (1)
0 Kudos
(4) Replies
cbragg
Level 7

You can retrieve properties using somthing like:

session.property("PROPERTYNAME")


Depending on the exact conditions that you want you can do something like:

If session.property("REMOVE")="ALL"
0 Kudos
tcom36
Level 7

I found a way to determine if I am installing or uninstalling.

I added in the installscript method of the custom action:

if MAINTENANCE then
MessageBox("Uninstall", INFORMATION);
endif;

if !MAINTENANCE then
MessageBox("Install", INFORMATION);
endif;

But, InstallShield behaves not quite as expected:
- when installing, I get in the MessageBox: Uninstall
- when uninstalling, I get in the MessageBox: Install

I thought MAINTENANCE is active when installing, but it seems it is active when uninstalling...
0 Kudos
cbragg
Level 7

Apologies I didnt see you wanted Installscript.
0 Kudos
mr_slava
Level 4

You should read manual on MAINTENANCE variable, which says: "This system variable is set to TRUE if your installation program is running in maintenance mode, or set to FALSE for a first-time installation.". According to this you will have correct script:


if (!MAINTENANCE) then
MessageBox("Install First Time", INFORMATION);
endif;


But the opposite is not true. If you have set MAINTENANCE variable, it doesn't mean user uninstalls the product. It means whatever it says user in maintenance mode which includes different types, such as MODIFY, REPAIR and REMOVEALL. You will be interesting in REMOVEALL type only if you need to identify uninstallation.
Hope this helps.
0 Kudos