Analysis Creation Issue

Hi Team,

I am creating one Analysis with the relevance given below:

if exists (value “UpdateInstalled” of it) of key “HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\Citrix Virtual Desktop Agent” of (x32 registries;x64 registries) then (value “UpdateInstalled” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\Citrix Virtual Desktop Agent” of (x32 registries;x64 registries) as string) else (“NA”)

The issue is it’s not picking up the else part of this relevance only picking up the if part.

Please help on this where i am getting wrong.

Please post code using the formatting tag (looks like </> in the toolbar)
Use the relevance debugger to help identify problems
Code defensively - your relevance assumes that one instance of the key exists and an error will be generated if there are zero or multiple instances

Direct update of your relevance

 if
   exists keys "HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\Citrix Virtual Desktop Agent" 
   whose
   (
     exists 
     (
       value "UpdateInstalled" of it
     )
     of it
   )
   of 
   (
     x32 registries;x64 registries
   )
 then
   (
     values "UpdateInstalled" of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\Citrix Virtual Desktop Agent" of 
     (
       x32 registries;x64 registries
     )
     as string
   )
 else
   (
     "NA"
   )

My preference

 values "UpdateInstalled" of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\Citrix Virtual Desktop Agent" of 
 (
   x32 registries;x64 registries
 )
2 Likes

The reason yours would fail is when a machine doesn’t have the registry hive your are trying to inspect the value from. By pluralizing the inspection using “keys” instead of “key” as @trn has, you avoid singular expression errors.

Using the approach @trn ends with is leaner in as much you are not adding “NA” to the DB for every endpoint if the endpoint doesn’t have the software installed.

1 Like

Thanks by using this relevance of your’s all resolved. Thanks a lot