Value of keys of key of registry - if then else

**Problem statement - The first query evaluates to true which is correct. However when I add the IF THEN ELSE in the second statement , I am expecting the product Name but I am getting the “” (returns nothing)

Registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8800

Relevance returns true
exists values “Product Name” whose( it as string as lowercase contains “mcafee virusscan enterprise server” ) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8800” of ( x64 registries; x32 registries )

Now I want to show the value of Product Name as the results of the following using the If THEN Else , however this returns the else “” and not the product name.

if (exists keys whose (exists values “Product Name” whose( it as string as lowercase contains “mcafee virusscan enterprise server” ) of it) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8800” of ( x64 registries; x32 registries )) then “McAfee VirusScan Enterprise Server” else “”

What does this return?

keys whose (exists values "Product Name" whose( it as string as lowercase contains "mcafee virusscan enterprise server" ) of it) of keys "HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8800" of ( x64 registries; x32 registries )

This is kind of hard to test because I don’t have a McAfee VirusScan Enterprise Server but I think you can simplify your relevance to:

if (exists keys whose (values "Product Name" of it as string as lowercase contains "mcafee virusscan enterprise server") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8800" of ( x64 registries; x32 registries )) then "McAfee VirusScan Enterprise Server" else ""

Do you need the if then at all? If you’re just printing the value of the Product Name key you could probably just get away with this:

(value "Product Name" of it as string) of keys "HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8800" of ( x64 registries; x32 registries)
1 Like

First statement returns nothing
Second statement has "type error - the left operand of ‘contains’ must be singular (line 1 characters 75,83)
third statesmen returns value “McAfee VirusScan Enterprise Server”

So the third statement provides what I need but I am curious as to how to fix second statement as that was what I was attempting to do .

You’ll want to play with the relevance I provide as I do not have this product so I won’t be able to test the relevance i’m providing.

It sounds like you just need to change values to value:

if (exists keys whose (value "Product Name" of it as string as lowercase contains "mcafee virusscan enterprise server") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8800" of ( x64 registries; x32 registries )) then "McAfee VirusScan Enterprise Server" else ""

Thanks for your help Strawgate. Problem solved.

I would try it like this:

unique values of (preceding text of first "%00" of it | it) of (it as string) of values "Product Name" of keys "HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8800" of ( x64 registries; x32 registries)