Run schedule task before windows service starts

scheduled-taskwindows-server-2003-r2windows-service

I want to run a schedule task before a specified windows service (Service A). Service A starts automatically.

What is the best approach to take? Do I need to convert the schedule task into a service (Service B) and configure Service A to depend on Service B?

Thanks

Best Answer

Services can't depend on scheduled tasks, so you can't do it that way.

Making a service depend on another may not do what you need, either; That just makes sure that service B is running when service A is started. If you need your custom task to finish its operations first, that won't help you.

What you can do is set the service to Manual start, and have your task start the service after doing what ever else it must do.