Help with Registry Key Relevance

I need help with a Relevance

Registry key not exist or registry key exist but is empty.
Currently using this and testing but not sure if it will work. Any help appreciated.

(not exists key “HKEY_LOCAL_MACHINE\SOFTWARE\Asset\Inventory\WarrantyEndDate” of registry) or exists keys “HKEY_LOCAL_MACHINE\SOFTWARE\Asset\Inventory” whose (exists value “WarrantyEndDate” of it and value “test” of it != “”) of registry

I find it best to first write the relevance to describe the exact, desired state. Then I put a NOT in front of it.

exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Asset\Inventory\WarrantyEndDate" whose (exists value "WarrantyEndDate" of it AND value "test" of it !="" ) of registry

then NOT

not exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Asset\Inventory\WarrantyEndDate" whose (exists value "WarrantyEndDate" of it AND value "test" of it !="" ) of registry

This way,
key is missing, your relevance is TRUE.
Key is present and has both the WarrentyEndDate value and has value test that does not equal “” your relevance is TRUE

If you want the relevance to be FALSE if the key is missing, you can move the NOT to inside of the WHOSE.

exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Asset\Inventory\WarrantyEndDate" whose (not (exists value "WarrantyEndDate" of it AND value "test" of it !="" )) of registry

mainly what I am trying to do is create a relevance to match a set of computer with this question.

q: does value exist at “HKEY_LOCAL_MACHINE\SOFTWARE\Asset\Inventory” and if value exist is the value blank .

This will be TRUE if the key exists and is blank.

exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Asset\Inventory" whose (value "WarrantyEndDate" of it = "") of registry

This will be TRUE if the key is missing OR is blank

not exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Asset\Inventory" whose (value "WarrantyEndDate" of it != "") of registry

Tried all that but it keep showing me undesirable result. I guess maybe my question of approach was all wrong.

Try native registry rather than registry.

Mainly my question is what is the relevance for a registry with a empty value.

That should do it. It is functionally equivalent to

not exists key “HKEY_LOCAL_MACHINE\SOFTWARE\Asset\Inventory” of registry
OR 
not exists value "WarrantyEndDate" of key “HKEY_LOCAL_MACHINE\SOFTWARE\Asset\Inventory” of registry 
OR 
value of key "WarrantyEndDate" of key “HKEY_LOCAL_MACHINE\SOFTWARE\Asset\Inventory” of registry = ""

While at the same time avoiding some potential errors that would come in the second or third clauses if the key/value doesn’t exist.

Everything report true even if key exist and even if key dont exist

exists key “HKLM\Software\Asset\Inventory” whose (exists value “WarrantyEndDate” of it AND value “WarrantyEndDate” of it != “”) of (x64 registries;x32 registries)

(x64 registries;x32 registries) did the trick thank all.

2 Likes