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

Add new Windows XP limited user with VBS?

Status
Not open for further replies.

dustbuster

Programmer
Dec 19, 2002
95
How can I create a new (local)limited user account in Windows XP Pro using scripting?

User: User1
Password: user1pass
 
You will be faced with the challenge of needing admin credentials on each of the workgroup PCs.

The code to create the account is simple:

Code:
strComputer = "atl-ws-01"
Set colAccounts = GetObject("WinNT://" & strComputer & "")
Set objUser = colAccounts.Create("user", "Admin2")
objUser.SetPassword "09iu%4et"
objUser.SetInfo

Once you have the account you can add the user to the Admins group using the command NET LOCALGROUP

The syntax of this command is:


NET LOCALGROUP
[groupname [/COMMENT:"text"]] [/DOMAIN]
groupname {/ADD [/COMMENT:"text"] | /DELETE} [/DOMAIN]
groupname name [...] {/ADD | /DELETE} [/DOMAIN]


I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
In the code above strComputer is the name of the current machine, right? And the code is creating the user "Admin2"?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top