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

Adding Users to Local Administrators Group

Status
Not open for further replies.

kachbo1

IS-IT--Management
Nov 16, 2004
40
0
0
GB
Can anyone help with the script which adds a user to the local Administrators group on a nos of computers.
 
Hello kachbo1,

You can use net localgroup command like this:
[tt] net localgroup administrators sales\ralphr /add[/tt]
mimic-ing an example given in net localgroup documentation adding domain (sales) user ralphr to the (local) administrators group.

Run it on the computer local, not from a remote computer. To do this, run the line from computer startup script for instance. Put those computers which need to do this into a (specially madeup) group is a way and an ingredient to use gpo-driven deployment plan.

regards - tsuji
 
Hi,

Thanks for that however

net localgroup administrators sales\ralphr /add

in my case ralphr (cn=ralphr,ou=abc,dc=efg) is part of a windows 2000 AD Domain. How do I use the net local group command for that?

 
Try this for an alternate solution:

Code:
strComputer = "."
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
Set objUser = GetObject("WinNT://DomainNameHere/UserNameHere")
objGroup.Add(objUser.ADsPath)

You can substitute a list of PCs in the strComputer list.

Spong
 
kochbo1,

You have to translate the LDAP dn to its sAMAccount name. If the job is managed by domain administration, it is the job they have to do. It's a simple separate job.

What Spong posted will do as well when person with local admin rights is logged in. There are so many different rolling out schemes, so cannot say for sure it suits your requirement.

- tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top