Avatar of certuran
Flag for Turkey asked on

How do I get list of members of Local Administrators group of computers or servers

I need a script.
How do I remotely get list of members of Local Administrators group of computers or servers.
Windows Server 2012Windows OSWindows Server 2008

Avatar of undefined
Last Comment

8/22/2022 - Mon
Lee W, MVP

If you want to do it for the whole domain, this Microsoft provided Powershell script should do the trick:

And there's a VB Script available from Microsoft that can do it for a single specified machine:

for single machine vbs giving error at row 3

set objArgs = WScript.Arguments 'This tells us that we want to acept arugments for our script
strGroup = "Administrators" 'We're setting strGroup to be equal to Administrators
strComputer = objArgs(0)'Here we are saying that the first argument that is passed to our script by the user should be assigned to strComputer
WScript.Echo "Computer: " & strComputer 'Now we're just echoing out the computer name
Set objGroup = GetObject("WinNT://" & strComputer & "/" & strGroup & ", group")
WScript.Echo " " & strGroup & " group members:"
For Each objMember In objGroup.Members
WScript.Echo vbCrLf & " Name: " & objMember.Name 'Echoing out each member name and then a carriage return.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
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.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

Dear Mahesh,
very good.
psexec @C:\Computerlist.txt net localgroup administrators > C:\groupmembership.txt
in the C:\groupmembership.txt every machine do not have any mark that is belong to it is own.
only problem is this.
However I have that below. It solves my problem.

@echo off
for /F "usebackq delims==" %%I in ("Machines.txt") do Call :begin %%I
goto :EOF

set srv=%1
:get info

@echo %srv%

psexec \\%srv% ............
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck

with psexec, net localgroup administrators command good solution. Also vbs can be used. Thank you