I’m trying to pull a list of installed software from the registry. The problem that I’m having is that I want multiple values to be returned at the same time, like Name/Version, etc…
The problem that I’m running into is if the value doesn’t exist then it kicks out the whole line. Compare two lines. The first will pull back half of the answers because they don’t all have a DisplayVersion value. I tried adding in some | “n/a” clauses but I just can’t get it to work. Any ideas? I specifically need the registry list as WMI is not pulling back everything I need.
(values “DisplayName” of it, values “DisplayVersion” of it) of keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry as string
(values “DisplayName” of it) of keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry as string
Looks like you have already found all the answers, just that last bit with an error?
Here is one statement to try base on your ideas.
(values “DisplayName” of it, (it as string) of value “DisplayVersion” of it | “N/A”) of keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry as string
Thanks, that did the trick. I had found another solution but it wasn’t as efficient or elegant as yours.
(value “DisplayName” of it as string | “n/a”, value “DisplayVersion” of it as string | “n/a”) of keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry as string
With that code, it pulls back every entry under the Uninstall hive and will even report “n/a, n/a” lines, which is not what I need. Thanks for you help on this.
By the way, have you looked at the regapps inspector? It is almost always faster to use a built-in inspector rather than querying the registry directly.