Value Exists and Is Not Blank

(imported topic written by SystemAdmin)

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.

Any help is greatly appreciated.

  • Mike

(imported comment written by SystemAdmin)

Heya Mike,

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
1 Like

(imported comment written by SystemAdmin)

I may have gotten this one myself…

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.

(imported comment written by SystemAdmin)

Thanks. I was posting my resolution as you were posting your feedback.

Your solution is definitely more elegant. Eventually I’ll have a better understanding of the relevance language…

  • Mike