Looking for services and their status

(imported topic written by tazmir91)

Hi, I am trying to create a property which is looking for either of the two services on systems and report back their status.

if exists (service “spooler” OR service “winmgmt”) then state of service else “Not Installed”

I am able to get info on a sigle service, but unable to make the above statement work. Thanks in advance for your help.

(imported comment written by Lee Wei)

Hi tazmir,

It is not clear to me how you want to report the information. There are 4 states in the situation above, but you are reporting only 2.

What happens if Spooler is running but WinMgmt is not installed?

This statement would work according to the logic above. As long as either one is installed, we will report the one of the states.

q: state of service “spooler” | state of service “winmgmt” | "Not Installed"
A: Running

This would be another statement for you to consider, which will report the states of the 2 services independently

q: (("Spooler - " & state of service “spooler”) | “Spooler not installed”) & "; " & (("WMI Service - " & state of service “winmgmt”) | “WMI Service not installed”)
A: Spooler - Running; WMI Service - Running

Lee Wei

(imported comment written by tazmir91)

Hi Lee, we are running BES console version 7.2.5.22; is fails to recognize “|” symbol and gives a syntax error about a character not allowed; when I run it in the rev. debugger, says | is an illegal character.

(imported comment written by Lee Wei)

Yes the bar “|” is an 8.0 inspector.

These are the equivalent statements using IF-THEN-ELSE.

if (exists service “spooler”) then (state of service “spooler”) else if (exists service “winmgmt”) then (state of service “winmgmt”) else (“Not Installed”)

(if (exists service “spooler”) then ("Spooler - " & state of service “spooler”) else (“Spooler not installed”)) & "; " & (if (exists service “winmgmt”) then ("WMI Service- " & state of service “winmgmt”) else (“WMI Service not installed”))

(imported comment written by SystemAdmin)

Is there a way to report on the service status and the startup state without manual registry inspection? State of service reports on the current status but not the startup settings. Thoughts?

What I am trying to do is create a property to check if the SCOM “HealthService” exists, the state, the version and the startup type without creating multiple properties. Is there a way to do an IF statement with multiple inspections as a result.

If (exists service “HealthService”) then (state of …, version of image path of, startup type of… else (“Not Installed”)

0 = Boot

1 = System

2 = Automatic

3 = Manual

4 = Disabled

Suggestions?