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

How to detect if it’s First install, Uninstall repair etc. ?

How to detect if it’s First install, Uninstall repair etc.


How to detect if it’s First install, Uninstall repair etc. ?
I’m aware of the Installed, REMOVE, REINSTALL properties but still it’s not clear how to detect the exact way action is done, For example:
First install can be done with Full UI or in silent mode,
Repair can be done under “Programs and Features” and click Repair or Click Change and then choose repair or even run same setup again enter maintenance mode and then choose repair.
Uninstall is same as the above.
So how can I know in what way Modify or Repair are done ?
Also if I have CA that run on Uninstall I guess it should be in UI and exe sequence so how can I make sure they don’t run twice ?

Labels (1)
0 Kudos
(1) Reply
Level 13

For any UI level the first install is a simple condition to write:

  • Not Installed

I am not certain how to distinguish from Maintenance mode and Repair mode. I looked at combinations of REPAIR and REPAIRMODE and ADDLOCAL but could not come up with something definitive. I could swear there is some sort of Msi property reference that can help with this but I could not find that reference quickly on MSDN. If you are concerned about a particular feature in maintenance mode then you could specify
  • Installed AND !F < 3 and &F >=3 where F=

For uninstall items you should only have to schedule the action in the execute sequence unless it has to affect your UI experience for some reason. If this is the case when you create the custom action you can specify that it should only run once.
The property that I use to check for uninstall is:

  • REMOVE ~= "ALL"

The tilde operator is used to specify that the check should be case-insensitive.

I will put in a plug for Robert D.'s excellent article for MSI tips:
Here is another link that may help depending on your requirements. Read down in this document as it has an excellent list of checking components and features states.
0 Kudos