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

installing/uninstalling a service through custom actions

Hi.
I have 4 custom actions for a service I want to install:
install, start, stop, uninstall. I also have a batch file for each task (install, start, stop, uninstall).

What is the correct syntax for getting my custom action to run the batch file? I can't run it directly because it isn't an .exe, and I tried making my actions look in the system folder, and the "target" was this, for example:
cmd.exe [INSTALLDIR]stop.bat

When I run my install package, it installs, but doesn't install the service (and I see no error messages or command prompt pop-ups). When I try to "remove" my install from add/remove programs in control panel, it brings up a command prompt with nothing entered, and after I close it, I get an error with my "stop" action.
However, if I run my install package rather than removing it from add/remove programs in control panel, and select the "Remove" option, it removes everything just fine, with no errors, and no command prompt pop-up.

Oh, the sequence and conditions for my actions:
install: AfterInstallServices; Not Installed
start: AfterStartServices; Not Installed
stop: AfterStopServices; REMOVE="ALL"
uninstall: AfterDeleteServices; REMOVE="ALL"

Can anyone offer some advice?
Labels (1)
0 Kudos
(4) Replies
RobertDickau
Flexera Alumni

Are the actions scheduled for deferred execution (I believe immediate execution is the default)? In general, actions that modify the target system should be marked for deferred mode. You might also verify that the uninstall actions aren't scheduled after RemoveFiles.

(As an aside, is using the standard actions for manipulate services out of the question? If you can use those, you don't need to worry about rollback, uninstallation, and all that.)
0 Kudos
zestym
Level 3

RobertDickau wrote:
In general, actions that modify the target system should be marked for deferred mode.


Thank you very much! This was the problem. It works now.

As an aside, is using the standard actions for manipulate services out of the question?


Just out of curiosity, what & where are the standard actions?

Thanks again for your help!
0 Kudos
RobertDickau
Flexera Alumni

The standard ones are the actions near your custom actions: InstallServices, StartServices, and the rest. You can get to the associated standard tables in a component's Advanced View, and the Component Wizard (right-click a feature in the Setup Design view) can help you get the data in there...
0 Kudos
zestym
Level 3

Great, thank you!
0 Kudos