Solved

Need VB Script to list all users in administrators group.

Posted on 2008-10-03
3
1,120 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
  • 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

733 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