Showing posts with label don't forget idiot. Show all posts
Showing posts with label don't forget idiot. Show all posts

Wednesday, 12 November 2014

Scheduling a service to stop and start


I lol at the vendor windows service that dies but appears to still be running from the services window.

  1. Create a stupid bat file to stop the task with the contents of
    NET STOP "ServiceNameGoesHere"
  2. Create a stupid bat file to start the task with the contents of
    NET START "ServiceNameGoesHere"
  3. Create a scheduled task to run the first bat.
  4. Create a scheduled task to run the second bat a few minutes later.
  5. Does this really need a post, am I really going to forget this? Probably.
Notes:
  • Use a domain user to run the tasks because it just doesn't want to work otherwise
  • Make sure the user has the log on as batch thing (http://www.power-programming.co.uk/post/2010/11/18/Task-Scheduler-This-task-requires-that-the-user-account-specified-has-Log-on-as-batch-job-rights.aspx)
  • The dudes on the internet reckon you might need to make the user an admin (I didn't)
  • The dudes on the internet reckon you might need to explicitly give the user Full Access to the folder and .bat even if they are an admin (I didn't)