VBS - Find members of local admin group

Use the below script to find the members of the local administrator’s group on a windows XP pc.

‘Start of script :

strComputer = “.”
Set colGroups = GetObject(”WinNT://” & strComputer & “”)
colGroups.Filter = Array(”group”)

For Each objGroup In colGroups

If objGroup.Name = “Administrators” Then

For Each objUser in objGroup.Members
szStr = szStr & objUser.Name & vbCRLF
Next

MsgBox objGroup.Name & ” Group” & vbCRLF & vbCRLF & “Members :” & vbCRLF & _
vbCRLF & szStr, 64, “Local Admin Group Members”
End If

Next

Leave a Reply

You must be logged in to post a comment.