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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to create local user via VBscript??

Status
Not open for further replies.

TheNewOne

Technical User
Mar 27, 2004
117
SI
Hi forum. I have a problem how to create new local user via VBscript and add him to local administrators group. Can somebody help me. THX
 
maybe this helps..
Set location = GetObject("WinNT://server,computer")
Set User1 = location.Create("user", "admin")
User1.SetPassword "something"
User1.SetInfo

Set Group = GetObject("WinNT://server/Administrators,group")
wscript.echo(user1.adspath)
Group.Add(User1.ADspath)

Hope it's works.

Richard
 
Thx for reply Richard. Script works fine, just one more thing. How to disable "Password newer expires" option??? Do you maybe know how??
Thx again

Jure
 
Set location = GetObject("WinNT://server,computer")
Set User1 = location.Create("user", "admin")
User1.SetPassword "something"
User1.Put "userAccountControl", &h10000
User1.SetInfo

This must be it. Hope you can use this.

Greetz,
Richard


 
Set location = GetObject("WinNT://server,computer")
Set User1 = location.Create("user", "admin")
User1.SetPassword "something"
User1.Put "userAccountControl", &h10000
User1.SetInfo

This must be it. Hope you can use this. You can make a const from the &h10000 so you know what it did when you read the script again in a year.
Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000

Greetz,
Richard


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top