Reputation: 138
Here's my code:
RegistryKey reg = Registry.LocalMachine;
var HKLM = reg.OpenSubKey(@"Software\\Microsoft\\Cryptography");
HKLM.DeleteValue("MachineGuid");
Problem: Even when I run it as an administrator; it will just give me an error that saying:
Cannot write to the registry key.
I can't delete anything in the local machine folder.
edit: I fixed it by unchecking "Prefer 32bit". or by checking if process is a 32 or 64bit application.
Upvotes: 1
Views: 1007
Reputation:
You need to specify the RegistryKey to be writable if you want the write access.
Registry.LocalMachine.OpenSubKey(@"Software\\Microsoft\\Cryptography",true);
Upvotes: 2