I want to get the software installed on the client. I use WMI and the registry as well.
I find most of the information under HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\UNINSTALL
However, Dropbox for example, does not appear there. Dropbox is located under HKCU so I want to read those keys as well. Simple, I thought, cause the path is the same, just the RegistryHive changes.
Problem
I can not see the key UNINSTALL though when I'm in CurrentVersion using the function GetSubKeyNames.
var root = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32)
var key = root.OpenSubKey(@"SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION") // works
var key = root.OpenSubKey(@"SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\Uninstall") // doesnt work
Also I tried this with RegistryView.Registry64 - I get the same result.
Whats printed out when I use GetSubKeyNames is the following:
Device Metadata
Explorer
Group Policy
GrpConv
Internet Settings
Media Center
Run
Shell Extensions
Telephony
ThemeManager
WinTrust
Does anybody know how I can fix this issue?
I ran into this issue as well, checking both the 32-bit and 64-bit views worked.
var HKLM32 = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, "computername", RegistryView.Registry32);
var HKLM64 = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, "computername", RegistryView.Registry64);
key32 = HKLM32.OpenSubKey(registryKeytoFind);
key64 = HKLM64.OpenSubKey(registryKeytoFind);
You may use: Registry.LocalMachine.OpenSubKey("Your Key Here").GetSubKeyNames()
But try changing the Platform target to both x86 and x64. You will see two different results.
To change Platform target: Goto Project -> Properties -> Build -> Platform Target Try setting this to X86, print results. Then set to x64, print results
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With