It may be necessary to delay the loading of a specific service until another service has started and is available for use, such as in an application stack, or for troubleshooting purposes. This quick post will walk-through creating a dependency, or sequence of dependencies, for services on a Windows machine.
Many built in Windows components, and third party applications, include dependencies configured during installation, these are visible from the Services GUI. In order to add dependencies after installation we can use the Windows Service Control (SC) command or add the entries manually in the registry.
Open an elevated command prompt, be aware that when we set dependencies any existing dependencies are overwritten. So first let’s list the current dependencies using sc qc, the example below will list the properties, including dependencies, of Service1.
sc qc "Service 1"
Use sc config to add a dependency. In the example below Service1 depends on Service2, this means that Service1 will not start until Service2 has successfully started.
sc config "Service 1" depend= "Service 2"
For multiple services use a forward slash.
sc config "Service 1" depend= "Service 2"/"Service 3"
To remove all dependencies use the following command.
sc config "Service 1" depend= /
Open regedit and locate the following key.
There will be a subkey listed for each installed service, click the subkey for the service you wish to configure.
Click Edit, and New Multi-String Value. Right click and Rename the value DependOnService. Right click and select Modify, enter the names of the services you want this service to depend on (one per line) and click Ok.
One thought on “Setting Service Dependencies in Windows”