getting windows service status from registry
I want to fetch the state of a windows service from registry key by accessing registry path. how can i do it ???
October 21st, 2010 10:48am

Would help to know some more details on what you're trying to accomplish, as they're might be a better way to do this other than using the registry. SC.exe is usually what is used to query/control Windows services. For example to check the status of the "Print Spooler" service on your local computer and on "SERVER" just run: SC.exe QUERY "Spooler" SC.exe QUERY "\\SERVER\Spooler"
Free Windows Admin Tool Kit Click here and download it now
October 21st, 2010 11:15am

thanks david , i checked sc query <service name> | findstr <status> fetched me the status but i need to get the path to key which gives state info from registry HKLM>Currentcontrolset>services gives a long list of all services.I need to know the key that gives me state whether running , stopped etc.
October 22nd, 2010 6:06am

I'm not sure this information is stored in the registry. Is there a reason you have to find this from registry?
Free Windows Admin Tool Kit Click here and download it now
October 22nd, 2010 8:18am

Hi, As I know, all services are stored in the following path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services You can click on the relevant service and find the Start key. For example, the Printer Spooler service status is stored at the following item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Spooler If the status is started, the value of Start key is 2. While if the status is stopped, the value of Start key is 3. Best Regards Dale Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
October 25th, 2010 3:53am

No. It is not correct. Start key mean only type of start the service. 2=automatic start 3=manual start It has no relation with the status! Id like also to know how to get status of any service from registry. I need it for monitoring services via Zabbix agent.
Free Windows Admin Tool Kit Click here and download it now
February 22nd, 2011 5:03pm

Hi, As I know, all services are stored in the following path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services You can click on the relevant service and find the Start key. For example, the Printer Spooler service status is stored at the following item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Spooler If the status is started, the value of Start key is 2 . While if the status is stopped, the value of Start key is 3 . Best Regards Dale Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ” No. It is not correct. Start key mean only type of start the service. 2=automatic start 3=manual start It has no relation with the status! Id like also to know how to get status of any service from registry. I need it for monitoring services via Zabbix agent.
March 2nd, 2011 4:42am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics