0

i am not able to understand how we can change mode of existing service from automatic to manual through installscript in InstallShield.

1 Answers1

1

You will want to launch CMD with installscript and run the command to alter the service.

I believe you use the LaunchApplication method, pass it WINSYDIR ^ "cmd.exe" for the application to launch as the first parameter.

For the next method parameter, which is the arguments to pass to the application you want to run, pass it

"/c " + WINSYDIR ^ sc +" config servicename start=mode"

Replace servicename with the name of the service you want to alter, and mode with one of these options

  • auto--a service automatically started at boot time, even if no user logs on
  • boot--a device driver loaded by the boot loader
  • demand--a service that must be manually started (the default)
  • disabled--a service that can't be started
  • system--a service started during kernel initialization

You might have to mess around with that second parameter. Basically, what we are doing here is running the command line, and a command to run with it in one shot. The /c parameter passed to the CMD tells it that you want to also pass CMD a command to run when you launch it. So the actual command that is being run is "sc config servicename start=mode". The WINSYDIR is just a Installscript macro that returns the location of the windows/system32 folder, where applications like cmd.exe and sc.exe live. This may not be needed if this path is already an environment variable on the machine.

Let me know if you have any questions.