Question
· Jul 16, 2018

Status of an operating system service

Hey Guys.

Is possible i know in COS the state of the one service the operation system?
One example:

What's state of service WinDefend for example, in operating system Windows.
I would like to know the status of the service.

Discussion (4)0
Log in or sign up to continue

test.mac:

#include %systemInclude

  #define getServState(%serviceName) ##class(%Activate.GenericObject).GetObject("winmgmts:\\.\root\cimv2").InvokeMethod1("Get",$$$FormatText("Win32_Service.Name=%1",$$$quote(%serviceName))).GetProperty("State")

  f s="wudfsvc","WSearch" s,": ",$$$getServState(s),!

Result:

USER>^test
wudfsvc: Stopped
WSearch: Running