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
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.
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”))
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”)