Solved

Need VB Script to list all users in administrators group.

Posted on 2008-10-03
3
1,111 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now