Tuesday, July 13, 2010

Edit Registry on Remote Machine in C#

There's not many sites with documentation on remotely editing registry so I'll include the code I incorporated into my R2E - Remote Registry Editor.  You can modify or add code to any remote registry (pending remote registry service is started for your Win32 machine).


 void ImplementChanges
(string machine, string keypath, 
string value, string t, 
string v, string key, string vn)
 {
 RegistryKey baseKey = 
RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, machine);


 RegistryKey sk1 = 
baseKey.OpenSubKey(keypath, true);
            string key1 = key;
            sk1.CreateSubKey(key1);


 sk1.SetValue(vn, value, 
RegistryValueKind.ExpandString);
}

No comments:

Post a Comment