Silverlight Relevance Help

(imported topic written by SystemAdmin)

Anyone have relevance to detect if silverlight is installed? We’ve got two questions:

1 - We’ve built some relevance to detect if the display name “Microsoft Silverlight” shows up under the uninstall keys in the registry (x32 or x64). But getting the version after that is tricky. While the version shows up under the uninstall keys in the registry, it is listed under the guid for the install. Since we’ve already searched the uninstall keys to detect the display name, is there a way to return the path to the keys so we can just pull in the display version and / or version keys?

2 - Silverlight also appears to put version information in the HKLM\SOFTWARE\Microsoft\Silverlight keys. I hate looking in to different places to detect something, as it could lead to false detections. But using that key we came up with this:

(NOT exists key whose (value "Version" of it as string equals "4.0.50917.0") of key "HKLM\SOFTWARE\Microsoft\Silverlight" of (if x64 of operating system then (x32 registry; x64 registry) else registry))

But it always returns true, no matter if the key does not exist or the version value does not match. And for whatever reason, my brain is not comprehending why this does not work.

(imported comment written by SystemAdmin)

  1. I’m not quite you need to know the path of where you got the data from, as long as the IT from where you found it is just passed along. Either one of the lines below work for me (only tested on a x32 machine).

a. The first uses a whose check on the keys to see whether the two value entries even exist and then dumps the version (or nothing) where it finds a match.

( IF (value “DisplayName” of it as string contains “Microsoft Silverlight”) THEN (value “DisplayVersion” of it as string) ELSE (nothing) ) of (keys whose(exists value “DisplayName” of it AND exists value “DisplayVersion” of it) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (if x64 of operating system then (x32 registry; x64 registry) else registry))

A: 4.0.50401.0

T: 28.572 ms

I: plural string

b. The second seems more straightforward in that it expects to limit the result to the key where a match is found and then return the version.

(value “DisplayVersion” of it as string) of (key whose(value “DisplayName” of it as string = “Microsoft Silverlight”) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (if x64 of operating system then (x32 registry; x64 registry) else registry))

A: 4.0.50401.0

T: 21.608 ms

I: singular string

  1. You just need to replace your first KEY with IT, as you are already where you want to be (no need to go one key lower) to check the Value. Perhaps you used the code from your uninstall lookup where you had to get the keys and then look under each of those keys to extract your value(s). (Btw, I get an error when the key doesn’t exist, so not sure how yours is working in that case.)

-Jim

P.S. I hadn’t thought about putting the registry operators in a list, but I’d be concerned that this would confuse the issue of where you’re getting the information.