-
Jul 21st, 2017, 08:54 AM
#1
Thread Starter
Lively Member
Windows Services
Good afternoon
In Visual Basic, I've build a suite of Windows Services to run various repetitive tasks throughout the day. I've also built a maintenance service which, at predefined times each day, stop and restart the other services so that they remain fresh.
The maintenance service (which I have to confess to being rather proud of) interrogates the appropriate service's controller status. If it finds that the status is either "Running" or "StartPending" then it issues a stop command, before Sleeping for 60 seconds. It then interrogates the status again and issues a Start command if the status is either "Stopped" or "StopPending".
Everything is working really well, but I've noticed that if a service has been changed so that its Startup Type is disabled, it generates an exception when it issues the Start command. Whilst this isn't necessarily a problem, it would mean that the exception log is being filled with phantom exceptions, when there might be a very good reason for a service having been disabled.
Is there any way of interrogating the startup type of a service just prior to that Start command being fired, so that I can decide whether or not to even try the Start?
TIA
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|