Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need VB Script to list all users in administrators group.

Posted on 2008-10-03
3
Medium Priority
?
1,136 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

604 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