• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 530
  • Last Modified:

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!
0
dcoluzzi
Asked:
dcoluzzi
1 Solution
 
Imran HashimSr. 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

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now