WMI Relevance for HP Bios Password Existence

I am trying to convert this Powershell code into wmi relevance.

#Connect to the HP_BIOSSetting WMI class

$HPBiosSettings = Get-WmiObject -Namespace root/hp/InstrumentedBIOS -Class HP_BIOSSetting

#Check the status of the setup password

 ($HPBiosSetting | Where-Object Name -eq "Setup Password").IsSet


integer value of select "isSet FROM HP_BIOSSetting WHERE Name = ‘Setup Password’" of wmi 
"root\HP\InstrumentedBIOS"

E: The expression could not be evaluated: Windows Error 0x80041017: Invalid query

This may be a wild goose chase because this statement returns nothing and it should return 1.

($HPBiosSetting | Where-Object Name -eq "Setup Password").IsSet

It’s the single-quotes - WMI doesn’t accept single-quotes and because it’s double-quotes but they conflict with relevance’s string definition, you need to convert them to ASCII. Try this:

integer value of select "isSet FROM HP_BIOSSetting WHERE Name = %22Setup Password%22" of wmi 
"root\HP\InstrumentedBIOS"
1 Like

ageorgiev,

Your suggested correction produced the same error. I think it is not the correct path.

Error: The expression could not be evaluated: Windows Error 0x80041017: Invalid query

ah, you have the incorrect slashes - it needs to be forward slashes, not backwards. Didn’t see that first time:

integer value of select "isSet FROM HP_BIOSSetting WHERE Name = %22Setup Password%22" of wmi 
"Root/HP/InstrumentedBIOS"

Nope, same error.

Error: The expression could not be evaluated: Windows Error 0x80041017: Invalid query

I can’t test you further because I do not have that namespace/class but my suggestion is to write it in WQL and make sure it works in that format: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_wql?view=powershell-5.1

Once it works as WQL, you should be able to plug it into BigFix Relevance too.

1 Like