- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Custom Action always being executed, when it shouldn't
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi all,
I have a custom action which executes a batch file. This should not run on uninstall so I have a 'NOT REMOVE' condition on the custom action, but every time I run the installer and try to uninstall it, it is throwing an error about this custom action. This is being thrown because the batch file doesn't exist anymore. (but it shouldn't even try to execute it) How do I fix this?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
To run the custom action only during Installation, use the condition:
Not Installed
Alternatively another approach is to prevent the custom action during uninstall which you can use:
Not REMOVE~="ALL"
There's a really helpful conditions cheat sheet which you might find useful for the future here: https://community.flexera.com/t5/InstallShield-Knowledge-Base/Common-MSI-Conditions/ta-p/3854
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
To run the custom action only during Installation, use the condition:
Not Installed
Alternatively another approach is to prevent the custom action during uninstall which you can use:
Not REMOVE~="ALL"
There's a really helpful conditions cheat sheet which you might find useful for the future here: https://community.flexera.com/t5/InstallShield-Knowledge-Base/Common-MSI-Conditions/ta-p/3854
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Thanks that's exactly what I needed. I find it really hard to find the relevant information for my problems. Whenever I google something I never get the pages that I actually need. Really annoying. Thanks for your information!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
If I only want to execute a custom action when the relevant component is being installed, what should I use? I think it would be '?ComponentName = 3', is that correct?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi @gomochainstall,
Thank you for your post.
You would need to use a component action condition:
$ComponentName = 3
A feature state condition is based on the feature's current state when the install starts. A feature action condition is based on the feature's final state when the install completes. Respectively, a component state condition is based on the component's current state when the install starts. A component action condition is based on the component's final state when the install completes.
Here is a link to the official Microsoft documentation about conditional statement syntax:
https://docs.microsoft.com/en-us/windows/win32/msi/conditional-statement-syntax?redirectedfrom=MSDN
Specifically, the Feature and Component State Values Section discusses this topic.
Please let us know if you have any questions or concerns. Thanks!
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)