fogbit
fogbit

Reputation: 2063

Get rid of error message box during StartService action

I need to try to stop some windows service during installation of my product and try to run after. The service is not related with the product, it may or may not exist on a certain PC. It may or may not run at the moment of product (de)installation. I don't care if service stop/run was successful or not, for example it's fine if the service fails to run after the installation complete.

I added ServiceControl table in my msi-package, i set Wait option 0. In the case the service is not installed on the system, i get an error MessageBox

Error message box

Besides /passive|/quiete installation option or using CustomAction, are there ways to get rid of this MessageBox? I just don't want it to appear.

I don't use WiX.

Thank you!

Upvotes: 1

Views: 38

Answers (1)

Captain_Planet
Captain_Planet

Reputation: 1336

I'm not sure if that error can be suppressed when using the ServiceControl table, but another option is to use Custom Actions:

You could use two type 34 custom actions instead (one to stop, one to start).

  • Set the Working directory to be SystemFolder.
  • Set the command line to be: NET [START|STOP] [ServiceName].
  • Set the return processing to be synchronous and to ignore the exit code.
  • Set the in script execution option to be 'Deferred in a System Context'.
  • Schedule the start/stop (you will need 2) custom actions between InstallInitialise and InstallFinalise.

Your custom action table will ultimately look similar to this:

Action              Type    Source          Target
NewCustomAction1    3170    SystemFolder    NET STOP ServiceName
NewCustomAction2    3170    SystemFolder    NET START ServiceName

and your InstallExecuteSequence similar to this:

Action              Condition       Sequence
NewCustomAction1    NOT Installed   1501
NewCustomAction2    NOT Installed   6599

Upvotes: 1

Related Questions