?
Solved

How to list who belong to a local administrator group in windows 2000

Posted on 2006-05-17
7
Medium Priority
?
403 Views
Last Modified: 2011-10-03
Hi,
Currently we have several users in our windows 2000 domain and windows 2000 desktops that are part of the Local Administrator Group on their own machines.

I need a script that can walk the windows 2000 desktop computers in my domain either doing a query to the AD about member computers or i can tell the script an IP range. The the script will tell me who (a group or a user) belongs to that machine's Local Administrator Group or is equivalent to a local administrator.

Note that they are *not* domain admins. They are admins, but only on their own machines. and I want to remove that priviledge but going thru 200+ computers is a real pain.

The report should be dumped to a text file.

If that solution already exists as a vbscript, please let me know where.

Note: I am not an expert vbscript programmer.

Thanks,
Erick.
0
Comment
Question by:eaperezh
  • 4
  • 2
7 Comments
 
LVL 15

Expert Comment

by:JackOfPH
ID: 16704971
ping
0
 
LVL 4

Author Comment

by:eaperezh
ID: 16708582
Sorry, JackOfPH, but what kind of answer is that?
0
 
LVL 16

Expert Comment

by:mdiglio
ID: 16709672
Hello,
This script is meant to run as a computer startup script.

It will enumerate the local Admin group and place all entries into a comma seperated file.
You will have Enter the path for this file into the script where indicated.

Right now the entry for Administrator and Domain Admins will not be logged.

The text file will end up looking like this
computerName, User1, User2
computerName2,user3

Copy and paste it into notepad and save it w/ a .vbs extension
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 16

Accepted Solution

by:
mdiglio earned 2000 total points
ID: 16709677
ForAppending = 8

Dim strInAdmin, i, strUser
Set WshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

'!!Create a text file in a shared folder that users can write to
'!! and place the path in quotes here:
Set objTextFile = objFSO.OpenTextFile("c:\InAdminGroup.txt", ForAppending, True)

Set objComputer = CreateObject("WScript.Network")
'Get Computer Name
strComputer = objComputer.ComputerName
Set colGroups = GetObject("WinNT://" & strComputer & "")
' Pull Environment variables for computer name
strComputer = WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")

colGroups.Filter = Array("group")
'Loop through groups
For Each objGroup In colGroups
      'only enumerate Admin group
      If objGroup.Name = "Administrators" Then
            For Each objUser In objGroup.Members
                  strUser = objUser.Name
                  If strUser <> "Administrator" And strUser <> "Domain Admins" Then
                        strInAdmin = strInAdmin & "," & objUser.Name
                  End If
            Next
            
            'If there are users in Admin group other than specified write it to the file
            If strInAdmin <> "" Then
                  objTextFile.WriteLine strComputer & strInAdmin
            End If
            wscript.quit
      End If
Next
wscript.quit
0
 
LVL 16

Expert Comment

by:mdiglio
ID: 16709702
I forgot to change line 9.
Instead of
Set objTextFile = objFSO.OpenTextFile("c:\InAdminGroup.txt", ForAppending, True)
it should be
Set objTextFile = objFSO.OpenTextFile("\\server\share\yourtextfile.txt", ForAppending, True)
0
 
LVL 4

Author Comment

by:eaperezh
ID: 16711682
mdiglio,

Just ot let u know, when your're working with a mixture of English and in my case, Spanish operating systems, the name of the group is "administradores" instead of "administrators".

Many many thanks,
0
 
LVL 16

Expert Comment

by:mdiglio
ID: 16713717
Glad it worked for you!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month16 days, 13 hours left to enroll

864 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