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

Adding local account with administrator rights

Status
Not open for further replies.

nicknel9

Technical User
Dec 7, 2007
5
US
Hey there,

So I have a script here, but what I want to do is add this user to the local administrators group... Also if it could check to see if the a "admin" has already been made then stop.. Any help would be great

'--------------------------------------------------
'Add local account addmin with administrator rights
'--------------------------------------------------
'
strComputer = "."
Set colAccounts = GetObject("WinNT://" & strComputer & "")
Set objUser = colAccounts.Create("user", "admin")
objUser.SetPassword "csdlocal!"
objUser.SetInfo



I tried to change the "user" in objUser to "Administrator" No go...
 
If you are working directly on the machine, then use the net localgroup command to add the user.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top