Posts Tagged ‘Using a Script to Add a Domain User to a Local Group’
2003 server - Monday, March 3, 2008 7:18 - 0 Comments
Using a Script to Add a Domain User to a Local Group
There are sometimes situations when you need to be able to script the process of adding a domain user to a local group on a machine. Here is a script that will do just that.
I ran into a scenario recently where I needed to add a domain group to the local administrators group of a large collection of workstations in my network. Rather than go around to all 500 of these machines individually I found a very useful little VBS script for getting this done.
option Explicit
Dim objGroup
Dim strComputer
On Error Resume Next
‘Variables you will want to change
strComputer = “.” ‘Computer is Local
‘Create Objects
Set objGroup = GetObject(”WinNT://” & strComputer & “/Administrators,group”)
‘Modify group memberships
objGroup.add(”WinNT://DOMAIN/GROUPNAME,group”)
Set objGroup = Nothing
Replace your variables, push this out via GPO, and voila! Enjoy!
Article written by MyComputerAid.com