Want to determine local administrators on multiple servers

This could probably be scripted if there is not a tool out there already for this but I need to determine memebers of the local Administrators group on about 150+ servers.  Other than manually going to each server and checking the Administrators group, can anyone think of an easy way to input a list of server names and get a CSV (or the like) out put of the server name and all members of the Administrators group?  Thanks!
LVL 1
dcoluzziAsked:
Who is Participating?
 
Imran HashimConnect With a Mentor Sr. IT Infrastructure ConsultantCommented:
The following script will work for you. Save the script to a file (for example adminmembers.vbs) and run. It will take the input from a text file "Computers.txt". Put all your computer names in this file with one name in each line. The script will walk through the text file to find computernames and then connect to them and find the members of Administrators group and put them in a csv file.

'-----------Script starts here-------------------------------
on error resume next
const ForReading = 1
const ForWriting = 2
const ForAppending = 8

Set oFS = CreateObject("Scripting.FileSystemObject")
Set oTS = oFS.OpenTextFile("computers.txt",ForReading)

Set ws = CreateObject ("Scripting.FileSystemObject")
Set w = ws.OpenTextFile (".\Admin Members.csv", ForAppending, True)

w.WriteLine "Information Collection started at " & now
Do Until oTS.AtEndOfStream
sComputer = oTS.ReadLine
  set Group = GetObject("WinNT://" + sComputer + "/Administrators,group")
  For Each Member in Group.Members
      mem = Member.adspath
        w.writeline sComputer & "," & right(mem,len(mem)-8) & "," & Member.class
  Next
Loop
wscript.echo "Done!"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.