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

Written by on Saturday, March 1, 2008 2:25 - 0 Comments

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



Leave a Reply

You must be logged in to post a comment.

2003 server - Sep 30, 2008 22:34 - 0 Comments

instant messaging srv records

More In Computers & PC


Microsoft Outlook - Mar 22, 2009 11:22 - 0 Comments

Outlook: Duplicates in Mailbox

More In Computers & PC