VBscript to Add users to local administrator group for list of given computer list

 

Below script takes input as list of computer names in the txt file and also takes group name or user account which you wanted to all as member of Administrators in all the computer listed in the txt file

on error resume next
dim filesys,filetxt
const ForReading = 1
Complist = Inputbox("Enter the path of text file which has list of Computers")
Complist = trim (Complist)
if Complist = "" then
wscript.echo "You did not Enter any thing!! "
wscript.quit(0)
end if

GroupAdd = Inputbox("Enter the Group name which you wanted to Add to the local computer Group")
GroupAdd = trim (GroupAdd)
if GroupAdd = "" then
wscript.echo "You did not Enter any thing!! "
wscript.quit(0)
end if

Set filesys = CreateObject("Scripting.FileSystemObject")
set filetxt = filesys.OpenTextFile(Complist,ForReading)

group = "WinNT://boston/" & GroupAdd

do Until filetxt1.AtEndOfStream
strComputer = filetxt.Readline
strComputer = trim(strComputer)

Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
objGroup.Add group
err.clear

loop

You can find the copy of the file from the below location

http://powershell.com/cs/cfs-filesystemfile.ashx/__key/CommunityServer.Components.UserFiles/00.00.00.30.62/AdAdminGroup.txt

3 thoughts on “VBscript to Add users to local administrator group for list of given computer list

  1. Pingback: best video card for gaming

  2. Hi,

    Do i need to modify any thing in the script. I ran the script and given test file path no staus from the script.

    Regards,
    Boopathi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s