Another script I wrote the other day, this one will take an input file called workstations.txt and produce a CSV which is easy to view in Excel and look at the local administrators group membership for the list of machines. The script could easily be modified to get the list from Active Directory although he framework I usually use for these is setup for a text file so I just export a list if AD is my source. The script will attempt to ping the machine before connecting in order to try and determine availability. If you have firewalls or routers filtering ICMP between the target machine and the host executing the script you may need to remove or modify this feature.
The script produces two files – a CSV and a log file. These three parameters are all configurable at the top by modifying lines 11 – 13:
Const LogFile = “LocalAdmins.log”
Const resultFile = “LocalAdministratorsMembership.csv”
Const inputFile = “c:\scripts\workstations.txt”
The script is attached below in a ZIP file. If you have any comments, bugs, etc, feel free to post them in the comments box below and I’ll certainly take a look. Enjoy.