Reputation: 93
sorry if this has been already answered here, I couldn't find it, I did not look for it more then 20 minutes I admit, but my college said it cant be done.
Our software runs two services while running, during a Windows update however, they can run in to problems as Windows stops it services or do things during an update.
I wonder if there is a way to detect if windows update is in progress/being downloaded etc (admin access granted) to use it so the services can act accordingly. Is it true that there is no such feature in windows right now?
Pointing me to the direction of where to dig is appreciated as well!
Thank you for your time and help! (developing .NET using xaml, c#, rest, zeroMQ)
Upvotes: 0
Views: 89
Reputation: 2641
Instead of detecting if a specific process (e.g. windows update) is running you're better of detecting and handling the Stop command that is sent to your service by the Service Control Manager. Implement an OnStop handler in you service (or any other appropriate handler like OnShutdown) and execute your required actions from there.This is a more generic approach and will help in all situations where your service is stopped. If really needed you can always detect in your OnStop handler if the windows update process is running at that time.
Upvotes: 1