Windows service dependency ONLY during startup

windowswindows-server-2008windows-service

I'm using windows server 2008 R2. When the server is rebooted, and only at this time, I need to ensure that service A starts, then service B, then service C.

I've researched dependencies, but as I understand it setting up service B to be dependent on service A and service C to be dependent on service B means that if A needed to be stopped, then B and C would also be stopped. I don't want that to happen. I only want the services to be dependent on each other when they are starting, but be able to stop them independent of each other.

I also looked at setting up a task schedule for stopping/starting the services, but the reboot times are not always scheduled so that doesn't seem appropriate, either.

Is it possible to have services be dependent on other services only when they are starting?

Best Answer

This is not possible; if ServiceA depends on ServiceB, a restart of ServiceB is guaranteed to force a restart on ServiceA. However, service dependancies can be changed programmatically; have a look into the sc command, especially the sc config depend= part.

Another viable option would be to set your services to manual mode, and then use a startup script (or a scheduled task configured to run at boot time) to launch them in the required order; this would still ensure the correct startup order, but without requiring explicit dependencies.