You are in a foul of registry redirection .
The best solution is to open a 64-bit registry view, for example:
using Microsoft.Win32; ... RegistryKey registryKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64). OpenSubKey(@"Software\Microsoft\InetStp\Components"); object value = registryKey.GetValue(@"WMICompatibility");
If you want your code to work on both 32-bit and 64-bit machines, you need to encode some switching between registry types.
Note The ability to access 64-bit representations from 32-bit processes was added only to .net libraries in .net 4. It seems that before that you had to use your own APIs, for example. with P / Invoke.
David heffernan
source share