Link to home
Start Free TrialLog in
Avatar of GodMother
GodMother

asked on

Add Domain users to LocalGroup in remote Windows Servers

Hi,
I would like to add few Domain user and Local users in Local Group of multiple servers.
I want to do this task via a script (VBS or any command line batch files) remotely from one servers without installing any additional tools.  The remote servers are combination of Windows 2000, Windows 2003, windows 2008. Thank You
Avatar of bbao
bbao
Flag of Australia image

Avatar of GodMother
GodMother

ASKER

How to add a domain user to local admin group in multiple remote computers please.

for example: I have users as  DOMAIN-A\User1,  DOMAIN-A\User2
And I need to add above users to Local Administrators group in ComputerA, ComputerB, ComputersC etc...
Create one global group in domain
Add all required domain users in this group

Create a simple batch file like this:
net localgroup administrators domain\group /add

Replace domain with your domain NetBIOS name and group with one created above

create one OU and move all client computers to that OU and apply new GPO on this OU
In GPO, configure above code as computer startup batch script, so that when client computers get rebooted next time the above group will automatically added to local administrators group on all client computers in OU

Alternatively you can use GPO restricted group feature to achieve same results
Only thing you need to add domain admins group as well in addition to above group
http://myitforum.com/cs2/blogs/rdixon/archive/2008/06/17/how-to-add-domain-accounts-to-local-administrators-group-using-gpo.aspx

Mahesh
I have used restricted group in production environment to add desktop engineers as local administrator on clients PC.

Create a group in AD, add all the users to group.
Create a GPO, Add the newly created group in Restricted groups and add the "Administrators" in "This group is member of" check attached screenshot.

attach the policy to computers container OU.
Run gpupdate /force and the group will be a part of "Local Administrators" group.
You cannot attach to the default computer container in AD. you will need to create a new OU and move all computer accounts there.


Note: Best is to use redir cmp, so that any new computer accounts goes to new OU. A complete different topic to discuss on it.
SCAP-0005.png
Its generally not a great idea to add individual users to local groups on servers. If you do then when the users leave and you remove their accounts you get "hanging SIDS" when you look at those group membership lists on the servers.

I would always create a group on the Domain and add the users to that group.

I would then use the "restricted groups" feature of group policy to control membership of the admins group. If you use the startup script the membership is not reset until a re-boot. If its set via policy the policy is re-applied at regular intervals. This means if some one tampers its fixed much sooner.
I do not have domain administrator privileges, but only local admin to my servers. And there still workgroup model servers in my environment due to the need of applications.
That why domain level will not work fully for me. From all the valuable inputs from different experts, I feel it is what I need to do manually or using simple batch files using net user command.
Seems so far there is no option to address my query. request please close the question.
ASKER CERTIFIED SOLUTION
Avatar of Dave
Dave
Flag of United Kingdom of Great Britain and Northern Ireland 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