Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
RegistryKey key = Registry.LocalMachine.CreateSubKey("SOFTWARE\\PRODUCTNAME");


An acception occured.
Access denied.

Any idea how to access the registry local machine and create the sub key.

I have created the subkey in Current User.
I want to create the subkey in Local Machine.
Posted
Updated 18-Jul-16 19:50pm

Hope this[^] might help you.
 
Share this answer
 
It looks like a permission issue. Non admin users or elevated admin users do not have permission right to modify HKEY_LOCAL_MACHINE key. What user are you using?
 
Share this answer
 
Comments
Sandeep Mewara 15-Apr-11 8:52am    
Comment from OP:
i am using admin user..
O/S windows 7 home premium
when i install the software how it can create the subkey in local machine....
Dave Kreskowiak 16-Apr-11 23:45pm    
No, you're not. An admin user does not do anything as an admin until you get asked about it or you launch an application that explicitly specifies it requires admin priv's in its manifest. You probably don't have a manifest file in your project.
Try to open the IDE that you are using as an Administrator since the Error is Access Denied, Editing the Registry can be harmful for the Computer and that is the reason the compiler throws such errors. ^_^
 
Share this answer
 
There are two parameters that you can supply when you open a key. Use second parameter as true while opening it and you will be able to modify it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900