Link to home
Start Free TrialLog in
Avatar of Brian
BrianFlag for United States of America

asked on

How to script adding global groups to local groups on multiple computers

Hello everyone.

I'm not scripting expert like most of you in here and thus could use your help.

I'm trying to add a domain global group and several other user accounts to the the local administrators group on several servers.  I know how to add one group to one server using the command below.

net localgroup administrators domain\group /add

This works great.  My question is how would I word a script/batch file to do that plus several other domain groups and users and then be able to apply that to a list of servers?

Let me know if you need further explanation.  I would prefer a solution using some form of script and not group policy.

Thanks,

Brian
SOLUTION
Avatar of Eagle6990
Eagle6990
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
LOL, I was all ready to say use Restricted Groups in Group Policy (since you can add groups and users without disrupting the existing ones in the local admins group), which is much easier, then I saw your final statement.


But like Eagle6990 said, so the script would look something like:


@echo off
net localgroup administrators domain\group /add
net localgroup administrators domain\username /add
net localgroup administrators domain\group#2 /add
net localgroup administrators domain\username#2 /add


Note like Eage said, you have to apply it to the Compuer Configuration section in GP, not the User configuration.
oops...I should read better...you just want to run the script to apply it remotely to a list of servers, right?

SOLUTION
Avatar of Jeff Beckham
Jeff Beckham
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the points...glad the script worked for you.