How can I edit a remote registry from 32-bit app to 64-bit server.
It very important: remote registry brunch must be 64bit, not 32bit.
I write code like this:
RegistryKey key = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, remoteServerName)
.OpenSubKey(SUBKEY,true);
if (key != null)
{
key.SetValue(KEY_1, Value_1);
key.Close();
key.Dispose();
}
It runs on 64-bit platform and edit 64bit server registry key.
How to edit the same key(64bit branch) via app runs on 32bit platform?
You need to pass an additional argument (RegistryView.Registry32
) to OpenRemoteBaseKey like the example below.
RegistryKey key = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, remoteServerName, RegistryView.Registry32)
These links would be helpful for you. http://msdn.microsoft.com/en-us/library/dd411615(v=vs.110).aspx http://msdn.microsoft.com/en-us/library/microsoft.win32.registryview(v=vs.110).aspx