I'm trying to add a key to LocalMachine
in registry. I'm using this code:
System.Diagnostics.Debugger.Launch();
RegistryKey key = Registry.LocalMachine.OpenSubKey("SOFTWARE", true);
RegistryKey newkey = key.CreateSubKey("1asdasds", RegistryKeyPermissionCheck.ReadWriteSubTree);
newkey.SetValue("ads", "ddsds");
newkey.Close();
I DO run it on Administrator account. I event run it with 'run as administrator", but nothing is added to registry :(.
When I change the LocalMachine
to CurrentUser
, actually it is added to CurrentUser
key. But how to force it to be added to LocalMachine?