Submitted By: Anonymous Submission

Lists all the members of the local Administrators group on a computer.

Visual Basic
Edit|Remove
Option Explicit
Dim objGroup, strComputer

strComputer = "localcomputer"

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

Sub EnumGroup(objGroup, strOffset)
Dim objMember
For Each objMember In objGroup.Members
Wscript.Echo strOffset & objMember.Name & " (" & objMember.Class &
")"
If (objMember.Class = "Group") Then
Call EnumGroup(objMember, strOffset & "--")
End If
Next
End Sub