Apologies in advance, as I am new to writing relevances for BigFix.
I’ve been searching the forums, and I have yet to find a solution to the problem that I am having.
I’m trying to determine if a registry key exists, and if so, return the value of that key as a string.
Right now, I have this:
if (exists values “SomeNumber” of keys “HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Numbers” of registry) then (values “SomeNumber” of keys “HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Numbers” of registry) as string else (“No registry entry exists”)
This works fine. The problem is that if the key exists, but the value of “SomeNumber” is blank, BigFix returns .
I’m trying to modify the relevance to include… value exists AND is not .
I’ve tried using WHOSE, but I’m clearly missing something regarding the syntax.
I think this will do what you want. You can test if the value is blank by comparing to the empty string “”
I also got my whose/it clause going to simplify things a bit.
q: exists keys "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Numbers" whose (exists value "SomeNumber" of it and value "test" of it != "") of registry
if (exists value “SomeNumber” of key “HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Numbers” of registry AND (value “SomeNumber” of key “HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Numbers” of registry != “”)) then (value “SomeNumber” of key “HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Number” of registry) as string else (“No registry entry exists”)
This returns the else statement if SomeNumber is .
It also returns the else statement if SomeNumber doesn’t exist.
Ultimately, I would like it to return the else statement if Number didn’t exist.