We help IT Professionals succeed at work.

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

21,230 Views
Last Modified: 2014-05-13
I need a script.
How do I remotely get list of members of Local Administrators group of computers or servers.
Comment
Watch Question

Lee W, MVPTechnology and Business Process Advisor
CERTIFIED EXPERT
Most Valuable Expert 2013

Commented:
If you want to do it for the whole domain, this Microsoft provided Powershell script should do the trick:
http://gallery.technet.microsoft.com/Query-members-of-Local-d0f393a6

And there's a VB Script available from Microsoft that can do it for a single specified machine:
http://blogs.technet.com/b/brad_rutkowski/archive/2007/01/06/find-out-the-members-of-the-local-administrator-group-remotely.aspx

Author

Commented:
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.
Next
Architect
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Lee W, MVPTechnology and Business Process Advisor
CERTIFIED EXPERT
Most Valuable Expert 2013
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
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

:begin
set srv=%1
:get info

@echo %srv%

psexec \\%srv% ............

Author

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

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.