How to Add a Dependency to a Windows Service

How to Add a Dependency to a Windows Service

Dependency on one other service:

sc config ServiceA depend= ServiceB

Above example means that ServiceA is dependent on ServiceB such ServiceA will not start until ServiceB has started. If you stop ServiceB, ServiceA will stop automatically.

Dependency on multiple other services:

sc config ServiceA depend= ServiceB/ServiceC/ServiceD/”Service name with spaces”

Above example means that ServiceA will not start until ServiceB, ServiceC, and ServiceD have all started. If any of ServiceB, ServiceC, or ServiceD has stopped, ServiceA will stop automatically.

To remove all dependencies:

sc config ServiceA depend= /

To list current dependencies:

sc qc ServiceA

Share this content:

Leave a Reply