Need help with analysis returning two values within a key

(imported topic written by rmnetops91)

I am having a heck of a time trying to get some analysis relevance to work properly.

Here is what I need to do:

  • Search the Un-install key of HKLM for all installations of Java
  • If one is found, display the DisplayName value AND the UninstallString value of that item it finds, onto a single line of output
  • If multiple versions of Java are installed/found, display each version and uninstall string on their own lines

The logic should work something like this:

  • Search HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall for a key that has a DisplayName value of “java™” or “java 2”

  • If a key is found, then display the following TWO values within that key: DisplayName - UninstallString

  • Find the next key under Uninstall that contains the words "java™ or “java 2” in it’s DisplayName value

  • If another key is found, then display it’s TWO values for DisplayName and UninstallString

This is what I came up with, but it doesn’t really work when multiple versions of Java are found, or it doesn’t seem to keep the DisplayName and UninstallString for the same specific version together.

if (name of operating system as lowercase starts with “win”) then if (exists values “DisplayName” whose (it as string as lowercase contains “java™” OR it as string as lowercase contains “java 2”) of keys of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry) then (value “DisplayName” of keys whose (exists values “DisplayName” whose (it as string as lowercase contains “java™” OR it as string as lowercase contains “java 2”) of it) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry as string & " - " & value “UninstallString” of keys whose (exists values “DisplayName” whose (it as string as lowercase contains “java™” OR it as string as lowercase contains “java 2”) of it) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry as string) else “Java not installed” else “Not running Windows”

Can any guru’s help me out?

(imported comment written by SystemAdmin)

Hi,

Try this:

if (name of operating system as lowercase starts with “win”) then if (exists values “DisplayName” whose (it as string as lowercase contains “java™” OR it as string as lowercase contains “java 2”) of keys of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry) then ((value “DisplayName” of it as string & " - " & value “UninstallString” of it as string) of keys whose (((it contains “java” OR it contains “j2se”) and (not (it contains “development kit” or it contains “auto updater”))) of (value “DisplayName” of it as string as lowercase)) of key “HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall” of registry) else “Java not installed” else “Not running Windows”

(imported comment written by rmnetops91)

That worked, but I needed to change the “java” and “j2se” values to exclude other false hits on the word “java” that are contained in our uninstall keys:

if (name of operating system as lowercase starts with “win”) then if (exists values “DisplayName” whose (it as string as lowercase contains “java™” OR it as string as lowercase contains “java 2”) of keys of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry) then ((value “DisplayName” of it as string & " - " & value “UninstallString” of it as string) of keys whose (((it as lowercase contains “java™” OR it as lowercase contains “java 2”) and (not (it contains “development kit” or it contains “auto updater”))) of (value “DisplayName” of it as string as lowercase)) of key “HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall” of registry) else “Java not installed” else “Not running Windows”

Thanks!!