cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
litewait
Level 3

Custom Action BEFORE prior version uninstall?

I need to stop a service that was incorrectly installed on a prior version of the application. When installshield goes to upgrade it runs the uninstaller from the prior version first so it seems I can't add a custom action before that happens.

Is there a was to add a custom/action step that fires BEFORE the prior version's uninstaller kicks in?
Labels (1)
0 Kudos
(7) Replies
RobertDickau
Flexera Alumni

If you're running new versions from the InstallShield environment, it could be InstallShield removing the old version first instead of your installer. You can turn this off using Tools > Options > Preferences > Uninstall before installing. Once you make that change, your new version will behave as it will out in the world.

Otherwise, if the old version is being removed, it's a major upgrade; so you should be able to put your custom code before RemoveExistingProducts to ensure it runs before the old version is removed.
0 Kudos
litewait
Level 3

Now I am scared. The custom action I added is sequence# 6 in Install->Execute and RemoveExistingProducts is #1500.

Is there a simple custom action like a messagebox I can show to make sure I am actually hitting the step before RemoveExistingProducts?

Sorry I am new to InstallShield and I just inherited a huge project with (of course) no documentation.

Thanks for the help.
0 Kudos
RobertDickau
Flexera Alumni

Easiest for quick testing is probably a new "Error" custom action, which displays a message and then exits the installer.
0 Kudos
litewait
Level 3

Ok that worked.

Now I just need to call in vbSCript:

net stop MyService
0 Kudos
litewait
Level 3

Tried to create a vbscript in the custom action to stop the service like:

LaunchAppAndWait(WINDIR ^ "system32" ^ "net.exe", "stop InstallTaskService", LAAW_OPTION_WAIT|LAAW_OPTION_HIDE);

And it doesn't work!

Any ideas....maybe I'll try to put a message box in there. Argh.
0 Kudos
RobertDickau
Flexera Alumni

If you do need to go down the custom action route, perhaps use a launch-an-EXE action that launches net.exe? (You'll probably want to add conditions to ensure it runs only when you want---not on uninstall, for example---but first things first.)
0 Kudos
litewait
Level 3

I got it to work using ShellExecute. Not sure why I vbscript doesn't work.
0 Kudos