C# Create Values in Registry Local Machine -
this not working me:
public bool createregistry() { if (!registryexists()) { microsoft.win32.registry.localmachine.createsubkey("software\\xelo\\"); microsoft.win32.registry.localmachine.opensubkey("software\\xelo").setvalue("hostname", (string)hostname, microsoft.win32.registryvaluekind.string); return true; } else { return updateregistry(); }
}
the exception error not authorized this. apreaciated
exeption: system.unauthorizedaccessexception | "cannot write registry key"
for working answer read comment on accepted solution
non-admin , unelevated admin users don't have rights modify hkey_local_machine key. run program 'as administrator'.
Comments
Post a Comment