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
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.
exists key “HKLM\Software\Asset\Inventory” whose (exists value “WarrantyEndDate” of it AND value “WarrantyEndDate” of it != “”) of (x64 registries;x32 registries)