Solved

Need VB Script to list all users in administrators group.

Posted on 2008-10-03
3
1,107 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
Comment Utility
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
Comment Utility
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
Comment Utility
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 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

17 Experts available now in Live!

Get 1:1 Help Now