Using a Script to Add a Domain User to a Local Group


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!

***


Chris Sanders is the network administrator for one of the largest public school systems in the state of Kentucky. Chris’s specialties include general network administration, windows server 2003, wireless networking, and security. You can view Chris’ personal website at www.chrissanders.org.

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top