Solved

Need VB Script to list all users in administrators group.

Posted on 2008-10-03
3
1,126 Views
Last Modified: 2012-05-05
We would like to be able to run a VBS script to tell us who is a member of the administrators group on a remote machine.

I can modify it to run on several computers, I just can't find the code tidbit that will tell me where to look for that information.

Scriptomatic does not return useful information, rather it returns a lot of information about the local accounts and then a bunch of info about what looks like every account on the domain. (see below)

I will probably be out until Monday for replying to questions.

Thanks in advance!




==========================================
Computer: computername
==========================================
Caption: computername\Administrators
Description: Administrators have complete and unrestricted access to the computer/domain
Domain: computername

LocalAccount: True
Name: Administrators
SID: XXX
SIDType: 4
Status: OK

Caption: computername\Backup Operators
Description: Backup Operators can override security restrictions for the sole purpose of backing up or restoring files
Domain: computername

LocalAccount: True
Name: Backup Operators
SID: XXX
SIDType: 4
Status: OK
0
Comment
Question by:TechniMemphis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 22636923
This should work...
arrComputers = Array("ComputerA", "ComputerB") 'etc...
 
For Each PC in arrComputers
  Set objAdmin = GetObject("WinNT://" & PC & "/Administrators")
  For Each objUser in objAdmin.Members
    wscript.echo objUser.Name
  Next
Next

Open in new window

0
 

Author Closing Comment

by:TechniMemphis
ID: 31502877
Wow, that was fast!
May I ask what you use as a reference for looking up items such as this?
I only have scriptomatic as a guide and haven't found anything particularly user friendly on the web (the microsoft developer's site is not very useful)
Thanks again!
Chad
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 22637268
Happened to have that one in my toolkit.
I have so many scripts stored across about 5 different systems, I can usually find what I'm looking for by searching for a keyword.
4guysfromrolla, w3schools and the hey scripting guys at microsoft are some of my favorite resources though...

Thanx for the grade. :^)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question