Link to home
Start Free TrialLog in
Avatar of Jene
Jene

asked on

Get the list of members from the Administrator group from almost 1000 windows servers as a single report

I need to get the list of members from the Administrator group from almost 1000 windows servers and then collect all the output in a spreadsheet for consolidation.

I have tried couple of commands to fetch the report on each server, but the challenging part is to export the report to the network share path because of permission issues as servers are in different network.

Please suggest me a feasible method to achieve the report either through Script or BMC Bladelogic job or SCCM. Thanks!
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

I would look into Powershell.  There are many examples out there.

This one seems pretty simple:
https://gallery.technet.microsoft.com/scriptcenter/Get-remote-machine-members-bc5faa57

Paste the function into a Powershell window then call it with a machine name:
get-localadmin("Machine1")

It would be a simple tweak to read a .txt file for all the machines and loop through them.

You can then export the output to a CSV file.

Another example that has the loop and CSV output:
http://hkeylocalmachine.com/?p=166

There are more if you look around.
For 1000 servers you should be using Splunk and it can gather User Groups, Error logs and more. Google for a Splunk consultant in your area.
Tie the environment an AD forest
Using GPO
Bmc and sccm

Can execute ...

Powershell, vbscript are likely your best tools using wmi to connect though you would need to have common access.
As others pointed out, your script would need to iterate when there is a group locating members ...

Your focus seems to be on the end result versus first getting the data in any format
Computer,
Members of administrators group
Usera
Userb
GroupB x
Members of GroupB
Administrators groupB userc (as an alternate to the above to simplify processing of data into a csv.
.
.
.


Once you collect the data, you can format it any way you want.
Avatar of Jene

ASKER

Am using below command and this is not getting the list of servers from servers.txt
someone please assist.

$server_names = Get-Content "C:\Servers.txt"
Foreach ($server in $server_names){
hostname > "X:\ADSEC_%computername%.txt"
net localgroup "Administrators" >> "X:\ADSEC_%computername%.txt"
}
Open a powershell window and post the results from:
type C:\Servers.txt
$server_names = Get-Content "C:\Servers.txt"
$server_names

Open in new window

This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.