Can I start and stop services in order?

Article:HOWTO4990  |  Created: 2006-09-12  |  Updated: 2008-09-05  |  Article URL
Article Type
How To

Where can I control the order for stopping and starting services defined in Wise for Windows Installer?

For example, during uninstallation, I would like to stop a few services before deleting them. I need to stop them in a specific order. I have three services in my installation; they are independent (not all have to be installed, it depends on target computer and user choice), but if they are installed together, one of them has to be stopped last because the other two services can use it.

Unfortunately this is a limitation with Microsoft's Windows Installer. In the ServiceControl table, there is no field to specify the order, so we are unable to order it.

Note that according to Microsoft's SDK, stopping a service but allowing its dependent services to run is also a limitation of Windows Installer. According to the SDK, the column Event (in the ServiceControl table) contains the operations to be performed on the named service. Note that when stopping a service, all services that depend on that service are also stopped. When deleting a service that is running, the installer stops the service. The values in this field are bit fields that can be combined into a single value that represents several operations.

To be able to stop and start the services in order from within a WiseScript called by the .msi, create a WiseScript and use the Start/Stop Service action from there with your needed conditions. Then use a Run WiseScript from Installation action to launch the WiseScript during install. 

Legacy ID


Article URL

Terms of use for this information are found in Legal Notices