We are in the process of installing Dell’s OMCI to our client machines so that we can dig deeper into the machine information using WMI. That being said, we would like to query if the machine has the OMCI installed and the version of that installation. The following relevance for the managed property returns the error
A singular expression is required.
. The goal is to produce either “Installed -x.x.x.x” or “Not Installed”. What am I missing?
if
(exists key whose (exists value "DisplayName" whose (it as string as lowercase contains "omci" of it) of it) of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of registry)
then
"Installed-" & ((value "DisplayVersion" of it as string) of keys whose (value "DisplayName" of it as string as lowercase contains "omci") of key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of registry as string)
else
"Not Installed"
if exists wmi "root\OMCI" then "installed" else "not installed"
And then you can write relevance to get OMCI information, here’s an example of the method I like to use:
item 1 of (1, "Other"; 2, "Unknown"; 3, "OK"; 4, "Non-critical"; 5, "Critical"; 6, "Non-recoverable") whose (exists (item 0 of it, (integer value of selects "GlobalStatus from Dell_Configuration" of wmi "root\DELLOMCI")) whose (item 0 of it is item 1 of it))
I did some work deploying OMCI and querying it a few months back. This is the relevance I use to detect if the machine is a Dell and what version of OMCI is on it:
string value of select “Manufacturer from Win32_ComputerSystem” of wmi contains “Dell” and not exists file “C:\Program Files\Dell\OpenManage\Client\Inf\OMCI.SYS” whose (version of it >= “7.6.0.732”)
This command in action script will do a silent install:
waithidden “__Download/setup_omci.exe” /s /v/qn
You can do a LOT of cool things with OMCI in installed on your Dell machines. Using I was able to push out a fixlet to adjust the BIOS setting for how the PC recovers after a power failure. The machines were configured to do nothing before, but the fixlet changes it to remember its last state when power resumes. Dell seems to be leaps and bounds ahead of other companies with client management tools. We have a ton of IBM POS machines that something like this would be vary helpful, but I have not been able to find anything similar for them.
I built some Fixlets to deploy and use OMCI a little while back… I was going to put them on BigFix Labs, but I never got around to it… The Fixlets/Analyses are attached to this post…
Here is how it works:
You deploy the OMCI components using the attached Fixlets (this is a simple deployment Fixlet that downloads OMCI components from Dell).
You can activate the analysis that I included to get back some data… The properties I included are related to power management, but you can create custom queries if you want.
Note that this is not extensively tested (although it seemed to work well for me) so be careful…
item 1 of (1, “Other”; 2, “Unknown”; 3, “OK”; 4, “Non-critical”; 5, “Critical”; 6, “Non-recoverable”) whose (exists (item 0 of it, (integer value of selects “GlobalStatus from Dell_Configuration” of wmi “root\DELLOMCI”)) whose (item 0 of it is item 1 of it))
This is really good relevance code. Is there any documentation on the
item
construct? it appears to be similar to CASE/SELECT in other languages.
Now i am trying to construct a relevance statement for the success criteria. What I would like to do is determine if a WMI statement has a certain value. The WMI query:
selects “* from Dell_IndicationStaticValues” of wmi “root/Dellomci”
generates a plural wmi select. in WMI Explorer, the same query generate multiple instances. i am interested in a particular instance. How do i use relevance to query/compare the value of a property of a particular instance?
item 1 of (1,
“Other”; 2,
“Unknown”; 3,
“OK”; 4,
“Non-critical”; 5,
“Critical”; 6,
“Non-recoverable”) whose (exists (item 0 of it, (integer value of selects
"GlobalStatus from Dell_Configuration" of wmi
"root\DELLOMCI")) whose (item 0 of it is item 1 of it))
This is really good relevance code. Is there any documentation on the
item
construct? it appears to be similar to CASE/SELECT in other languages.{quote}
I got the idea for that relevance from the “Plurals with Tuples” section (page 20) of the
Relevance Language Quick Reference
. It was the best way I found to avoid a long, complicated series of IF statements.
Regarding your second question, there’s no straightforward way (that I know of, at least) to get the Nth item in a plural. Would adding the IndicationIdentifier to the select statement solve your problem?
string value of select
"OccurrencesCount from Dell_IndicationStaticValues where IndicationIdentifier='Dell.OMCI.Events.CurrentProbe'" of wmi
"root/Dellomci"
Ok…i think i am seeing the light at the end of the proverbial tunnel with my WMI relevance. the last thing that i am having trouble with is writing WMI relevance that may or may NOT exist. Specifically, I am checking to see if the computers have the LowPowerS5 state in the SMBIOS set to a particular value.
unfortunately, there are some computers that may not have this feature. Therefore if the relevance was ran on that computer i would receive a error
The expression could not be evaluated: Windows Error: unknown error 0x80041002
which i would assume means that i couldn’t reference that property.
How do i check for the existence of the property w/o generating an error?
i was thinking on the lines of
selects “* from Dell_SMBIOSSettings” of wmi “root/dellomci” as string
and check for the value “LowPowerS5=4” as one of the plural strings or even a sub-string.
Here’s one way to do it. I’m not sure this is the best way though because it’s running the WMI query twice, which is a slight performance penalty.
if exists (names of (selects "* from Dell_SMBIOSSettings" of wmi "root/dellomci")) whose (it = "LowPowerS5") then string values of selects "LowPowerS5 from Dell_SMBIOSSettings" of wmi "root/dellomci" else "n/a"
Edit:
This probably works better:
(if exists (names of properties of it) whose (it = "LowPowerS5") then string value of property "LowPowerS5" of it else "n/a") of (select object "* from Dell_SMBIOSSettings" of wmi "root/dellomci")
WOW!!! that worked like a charm! when i was trying to discect it, it realize that I have ALOT to learn. Writing compact but functional relevance can be art instead of work!
One more questions about this subject and relevance. I have a managed property that executes and resolves properly on Windows XP SP3 properly. However, the same relevance does not return the expected value on Windows XP-x64 SP2.
Here is the relevance code.
if (exists key whose (exists value "DisplayName" whose (it as string as lowercase contains "omci" of it) of it) of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of registry) then ((value "DisplayVersion" of it as string) of keys whose (value "DisplayName" of it as string as lowercase contains "omci") of key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of registry as string) else "N/A"
This code checks to see if a piece of software is installed/visible from the Add/Remote Programs (it was taken from the retrieved properties builder webpage.). I have logged on the machine and transversed the Registry to see fo the key/value pair exists, and it does. Is there thing that I have to take into consideration for 64bit Windows OS?
Hmm… I don’t have an XP 64-bit machine to test this with. When I tried it on a Server 2008 machine it worked fine. There is an 'x64 registry" inspector that you could try:
if (exists key whose (exists value "DisplayName" whose (it as string as lowercase contains "omci" of it) of it) of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of x64 registry) then ((value "DisplayName" of it as string) of keys whose (value "DisplayName" of it as string as lowercase contains "omci") of key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of x64 registry as string) else "N/A"
That error means that the sha1 listed for the file in the download action differs from the sha1 of the file that was downloaded.
You should manually download the files, verify their integrity and sha1, and update the sha1 listed in the action script to match the sha1 of the files you downloaded.