Checking for existence of multiple registry keys

(imported topic written by JasonWalker)

I’m looking for an easier way to check whether multiple ActiveX objects are registered to the system. If any of the following CLSID’s are not registered, I want to return true.

“{7D3320B5-09C7-4F37-88EC-95DD65330634}”

“{EE09B103-97E0-11CF-978F-00A02463E06F}”

“{3B7C8860-D78F-101B-B9B5-04021C009402}”

“{1EFB6596-857C-11D1-B16A-00C0F0283628}”

“{0496F209-8F7D-49B4-B35F-B2537CEDCBD6}”

I know I can do this “the hard way” but I’m looking for a generic way to make it scale as I look for more settings. I could do

(not exists key “{7D3320B5-09C7-4F37-88EC-95DD65330634}” of key “HKLM\Software\Classes\CLSID” of x32 registry) OR (not exists key “{EE09B103-97E0-11CF-978F-00A02463E06F}” of key “HKLM\Software\Classes\CLSID” of x32 registry) OR (not exists key “{3B7C8860-D78F-101B-B9B5-04021C009402}” of key “HKLM\Software\Classes\CLSID” of x32 registry) OR (not exists key “{1EFB6596-857C-11D1-B16A-00C0F0283628}” of key “HKLM\Software\Classes\CLSID” of x32 registry) OR (not exists key “{0496F209-8F7D-49B4-B35F-B2537CEDCBD6}” of key “HKLM\Software\Classes\CLSID” of x32 registry)

… but I get lost just copy/pasting that. When I treat this as a set -

(exists key it of key “HKLM\Software\Classes\CLSID” of x32 registry) of (“{7D3320B5-09C7-4F37-88EC-95DD65330634}”; “{EE09B103-97E0-11CF-978F-00A02463E06F}”; “{3B7C8860-D78F-101B-B9B5-04021C009402}”; “{1EFB6596-857C-11D1-B16A-00C0F0283628}”; “{0496F209-8F7D-49B4-B35F-B2537CEDCBD6}”)

… the “it” always refers to “key “HKLM\Software\Classes\CLSID” of x32 registry”; I can’t get “it” to refer to the set of CLSIDs. There’s also and “of” to contend with - either “of key X” or “of x32 registry” or something that gets in my way however I try to arrange it.

Using the “file” inspector I can search for multiple files this way -

exists (file it) of (“c:\file1”;“c:\file2”;“c:\file3”)

Anyone have any guidance that could help me out?

(imported comment written by MattPeterson)

I’ve ran into the same problem trying to reference a key with “it”. The “it” in “of key it” always seems to be directed to “of registry”, or in your case “of key”. I’ve tried formatting many different ways, but couldn’t get it to work the way I wanted. I would be intereseted if anyone else has found a way to do this.

One suggestion to simplify your statement is to use a regex statment and combine all our keys there. example:

exist key whose (name of it = (regex “({7D3320B5-09C7-4F37-88EC-95DD65330634}|{EE09B103-97E0-11CF-978F-00A02463E06F})”)) of key “HKLM\Software\Classes\CLSID” of x32 registry

You need to escape and { } brackes with “”.

(imported comment written by JasonWalker)

The closest I’ve gotten, and it’s horribly convoluted, is to build a set of the the names of the keys I’m looking for, and subtract from that the set of all key names that are actually present. If the number of elements in the resulting set is not 0, then I have keys missing.

number of elements of (set of (“{7D3320B5-09C7-4F37-88EC-95DD65330634}”;“{EE09B103-97E0-11CF-978F-00A02463E06F}”;“{3B7C8860-D78F-101B-B9B5-04021C009402}”;“{1EFB6596-857C-11D1-B16A-00C0F0283628}”;“{0496F209-8F7D-49B4-B35F-B2537CEDCBD6}”) - set of names of keys of key “HKLM\Software\Classes\CLSID” of x32 registry) > 0

(imported comment written by jgstew)

Still kind of ugly, but different:

not (5 = number of keys whose(name of it contains “7D3320B5-09C7-4F37-88EC-95DD65330634” OR name of it contains “EE09B103-97E0-11CF-978F-00A02463E06F” OR name of it contains “3B7C8860-D78F-101B-B9B5-04021C009402” OR name of it contains “3B7C8860-D78F-101B-B9B5-04021C009402” OR name of it contains “0496F209-8F7D-49B4-B35F-B2537CEDCBD6”) of key “HKLM\Software\Classes\CLSID” of x32 registry)

This should be more efficient / cleaner:

not (5 = number of keys whose(set of ("{7D3320B5-09C7-4F37-88EC-95DD65330634}";"{EE09B103-97E0-11CF-978F-00A02463E06F}";"{3B7C8860-D78F-101B-B9B5-04021C009402}";"{1EFB6596-857C-11D1-B16A-00C0F0283628}";"{0496F209-8F7D-49B4-B35F-B2537CEDCBD6}") contains name of it) of key “HKLM\Software\Classes\CLSID” of x32 registry)