Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a local user account.

Status
Not open for further replies.

WilliamUT

IS-IT--Management
Joined
Oct 8, 2002
Messages
182
Location
US
I want to create a user in the "users and passwords" section (in the control panel) with a vbscript. The only script I can find adds users to the mycomputer ---> manage ---> users and groups which doesnt accomplish what i need. Does anybody know how to do this with a script? Thanks

(i have checked the microsoft site)
 
I pulled this off of a site that doesn't exist anymore swynk.com so I don't know who to contribute this to but with some minor modifications it worked for me. You may have to set the password and group membership before the user.setinfo line depending on your group policy's.

Set WshNetwork = CreateObject("WScript.Network")
ContainerName = WshNetwork.ComputerName
Newuser = "testuser"
newpass = "123456"
Set Container = GetObject("WinNT://" & ContainerName)
Set User = Container.Create("User", NewUser)
user.setpassword(newpass)
User.SetInfo


Hope this helps
 
This doesnt do what i need it to do. It adds a user in the wrong place under my computer ---> manage ---> users i need to add a user in the control panel ---> users and passwords...they are 2 totally different things. Thanks for trying though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top