Click here to Skip to main content
15,946,179 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
For a registry key we can right click on particular key and selecting permissions option and adding new user by clicking on Add button.
Is it possible to do above things through vb.net code?Pls help..
Posted
Updated 18-Apr-12 18:41pm
v2
Comments
Sergey Alexandrovich Kryukov 19-Apr-12 1:09am    
Not clear. What key? What user? A user of what? Do you want to add a user account to the OS? If so, this is not just a key...
--SA

 
Share this answer
 
The question is not clear — please see my comment to the question.

In case you want to create a new user account, I want to tell you just one thing: strictly speaking, you cannot do it by at least one simple reason: adding an account is not just adding some keys and other data to the Registry. This is explained here:
http://en.wikipedia.org/wiki/Windows_Registry[^].

Please pay attention that there are separate registry files for each user, NTUSER.DAT and USRCLASS.DAT, so you would need to create them, among other things. As before the files are created and before the newly created user is not logged on the usual .NET interface of Microsoft.Win32.Registry could not be applied to those files, you would need to create them on lower level. I am not sure if this is even documented.

Nevertheless, adding a new user account using .MET is possible, but is has nothing to do with (direct) Registry manipulations.

This is the Microsoft article explaining how to add a new user programmatically using Directory Services:
http://support.microsoft.com/default.aspx?scid=kb;en-us;306273[^].

See also this discussion:
http://stackoverflow.com/questions/5984600/how-to-programmatically-create-windows-user-accounts-on-windows-7-or-windows-ser[^].

—SA
 
Share this answer
 
Comments
saransath 19-Apr-12 2:25am    
Hi,
Pls follow below steps.
Right click on any reistry key.Select "Permissions".In that there will be list of groups or user names.Is it possible to add user to that list using vb.net code?
Sergey Alexandrovich Kryukov 19-Apr-12 12:34pm    
You should better be way more clear in your questions.

How about exact key name? I only see the whole word "Permissions" in this key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Permissions

But the work "permissions" appears many times in the Registry. And what is the problem to add some data? You can use Microsoft.Win32.Registry.
--SA

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