add update windows users windows user management

Sometimes, we may need to add/update the windows user management functionality in our windows application or windows service. In such cases, we can just use the 'net user' functionality of the windows operating system. Refer the below command to perform user operations.

NET USER
[username [password | *] [options]] [/
         username {password | *} /ADD
         username [/DELETE] [/DOMAIN]

We can easily fire these commands using Process .NET class. Refer the examples in C# below

Process p = System.Diagnostics.Process.Start("c:\\windows\\system32\\net","user username newpassword".
//This will update the user username with the password newpassword

Process p = System.Diagnostics.Process.Start("c:\\windows\\system32\\net","user username newpassword /ADD".
//This will add a new user wth username username and password newpassword

The second arcument of above start function are the arguments to the command "net"

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading








Quality & Affordable Web Development | About the Author | Hosted By Windows Hosting | Discuss With Experts At Webmaster Forums