Search code examples
windowswindows-servicesscheduled-tasksvhdvirtual-disk

Boot order on windows: Services vs scheduled tasks?


We deploy our software on a VHD drive that we load with diskpart and mount as drive. Currently we use schtasks.exe to remount the drive when the system reboots.

Question: Can we use sc.exe to add an automatic service, where the service resides on the virtual hard drive?

In other words, what is the order at boot at which services are added?

And if I cannot use schtasks.exe to add a mount task before the services run, what can I do to make sure that the service will start (given the exe is located on the VHD). (actually, it is a nodejs app, and I am looking at the windows-services package to start it).

Target Machine: Windows 2008R2, 64 bit.


Solution

  • schtasks.exe use service called Task Scheduler,
    You can try to add it as dependency to your automatic service.

    When the computer starts, it uses this entry to verify that the service or services listed in this value ("DependOnService") are started before attempting to start the dependent service.

    Read this KB for more information.