Get Disabled Windows Service Status

I wrote a Windows service and set its startup type to "Automatic." But after installing the service, the user can change his type to "disabled".

Is there any way to determine the status of this service after installing the service? Can I prevent a user from changing the startup type so that it is always β€œAutomatic”?

thanks

+2
source share
3 answers

There is no API for this, but you can check the service start mode in the registry at HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ ServiceName \ Start. This value will be either 2 (automatic), 3 (manual), or 4 (disabled).

+2
source

You cannot forbid the user to disable it, except for operating system permissions, unless you are the only administrator for this field, you will not have such control.

You can use a third-party monitoring tool such as Nagios to monitor services on all of your servers and alert you when they stop running. This has other advantages, as it also allows you to keep track of many other things, such as the MSMQ queue length, disk space, and memory usage (virtually anything in performance counters).

0
source

Source: https://habr.com/ru/post/914538/


All Articles