WMI Query for BIOS status failing

I am trying to query BIOS settings and the debugger keeps coming back with a Windows error. I am debugging using the local client to evaluate the code.

Where am I going wrong here?

if (exists wmi "root\hp\instrumentedbios") then ((If (exists (select objects "CurrentValue from HP_BIOSSetting" of wmi "root\hp\instrumentedbios") whose string value of property "currentsetting" of it = "TPM")) then "test" as string) else "null"

Thanks for any help!

Found It!

The HP_Setting is a composite classes that was referencing 2 other classes (at least). We just drilled down to the original data source.

if (exists wmi "root\hp\instrumentedbios") then ((if (exists (select objects "name, currentvalue from HP_BIOSEnumeration" of wmi "root\hp\instrumentedbios") whose (string value of property "Name" of it = "OS Management of TPM" and string value of property "currentvalue" of it = "Enable")) then "Enabled" as string  ELSE "Disabled") as string) else "Unknown"

You don’t need to use the IF/THEN/ELSE you just need to use plurals instead.

This will give you the raw data:

select objects "name, currentvalue from HP_BIOSEnumeration" of wmis "root\hp\instrumentedbios"

This should give you the correct result:

string values of properties "currentvalue" of select objects "name, currentvalue from HP_BIOSEnumeration where name like 'OS Management of TPM'" of wmis "root\hp\instrumentedbios"

This will be more efficient, and will return nothing on systems that don’t have this instead of an error, while on systems that do have this, it will return the correct value.

If you had Dell and Lenovo systems as well, you could combine this relevance like this:

( "Whatever The Equivalent is for Dell" ; "Whatever The Equivalent is for Lenovo" ; string values of properties "currentvalue" of select objects "name, currentvalue from HP_BIOSEnumeration where name like 'OS Management of TPM'" of wmis "root\hp\instrumentedbios" )

This would then give you a valid result for all 3 in a single query without using IF/THEN/ELSE.