Submitted By: Anonymous Submission

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

Visual Basic
Option Explicit
Dim objGroup, strComputer

strComputer = "localcomputer"

Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
Wscript.Echo "Members of local Administrators group on computer " &
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
End Sub