Finding multiple memgers of a group



Hi,

I am working on a script that will determin if three different ID's
are in the local Administrators group on a long list of servers. I can
get my script to reliably report on ONE user, but If I try fro more
than one, I get mixed results and I can't trust the accuracy. Can
someone point me to a sample script or discussion on finding multiple
users in a group?

This script will tell me if JoeUser is a memger of the Administrators
group on a list of servers.

Option Explicit
Dim objGroup, strComputer, objFSO, objTextFile
Const ForReading = 1
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\Scripts\servers.txt",
ForReading)
Do Until objTextFile.AtEndOfStream
strComputer = Trim(objTextFile.Readline)
If (strComputer <> "") Then

Set objGroup = GetObject("WinNT://" & strComputer & "/
Administrators,group")
Wscript.Echo "Members of local Administrators group on computer " &
strComputer
Call EnumGroup(objGroup, "")
End If
Loop

Sub EnumGroup(objGroup, strOffset)
Dim objMember
For Each objMember In objGroup.Members
'Wscript.Echo strOffset & objMember.Name & " (" &
objMember.Class & ")"
If (objMember.Name = "JoeUser") Then
Wscript.Echo strOffset & objMember.Name & " (" &
objMember.Class & ")"

End If
Next
End Sub

.



Relevant Pages

  • Re: Finding multiple memgers of a group
    ... someone point me to a sample script or discussion on finding multiple ... Dim objGroup, strComputer, objFSO, objTextFile ... Wscript.Echo "Members of local Administrators group on computer " & ... method and it returns True if the corresponding object is a member. ...
    (microsoft.public.scripting.vbscript)
  • Re: Use the "Managed By" field in AD to set as local Admin
    ... I guess you could code a script to read ... the managedBy attribute, then add that user to the local Administrators ... Dim objNetwork, strComputer, objManager ... permissions to add members to the local Administrators group. ...
    (microsoft.public.windows.server.active_directory)
  • Re: need to modify local group membership via VBscript
    ... A logon script runs with the credentials of the user, ... ' Bind to local Administrators group on remote computer. ... Wscript.Echo "Domain Admins already in Administrators on " & strComputer ...
    (microsoft.public.windows.server.scripting)
  • Re: Use the "Managed By" field in AD to set as local Admin
    ... I think the way must be in the logon script. ... the managedBy attribute, then add that user to the local Administrators ... Dim objNetwork, strComputer, objManager ... permissions to add members to the local Administrators group. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Adding Domain Admins to local computer administrator groups
    ... Create a machine startup GPO (machine startup will be run ... as SYSTEM context) ... >done via a script and if so can I get a copy of the ... >' Bind to local Administrators group. ...
    (microsoft.public.windows.server.scripting)