ADSI sample - checks all members of strGroup. If an element of this group is not member of the strM
ADSI sample - checks all members of strGroup. If an element of this group is not member of the strMemberList, then False is returned.
Rate ADSI sample - checks all members of strGroup. If an element of this group is not member of the strM
(2(2 Vote))
' This function checks all members of strGroup. If an element of this
' group is not member of the strMemberList, then False is returned. Otherwise,
' True is returned.
' This functions is often used to check if the Domain Admin or Enterpise Admin
' group has no unexpected members.
' Check out http://www.activexperts.com for more samples and components
Function VerifyGroupMembers( strDomain, strGroup, strMemberList )
VerifyGroupMembers = False
Set objGroup = GetObject("WinNT://" & strDomain & "/" & strGroup & ",group")
arrUsers = Split( strMemberList, "," )
For Each objUser In objGroup.Members
WScript.Echo "Checkiing group member " & objUser.Name
bMemberFound = False
For i = 0 To UBound( arrUsers )
If( UCase( Trim( arrUsers(i) ) ) = UCase( Trim( objUser.Name ) ) ) Then
WScript.Echo "Member found: " & objUser.Name
bMemberFound = True
Exit For
End If
Next
If( Not bMemberFound ) Then
WScript.Echo "Member NOT found: " & objUser.Name
VerifyGroupMembers = False
Exit Function
End If
Next
VerifyGroupMembers = True
End Function
' Main
Do
strDomain = inputbox( "Please enter the domain name.", "Input" )
Loop until strDomain <> ""
Do
strGroup = inputbox( "Please enter the name of the group you want to check (for instance: Domain Admins).", "Input" )
Loop until strGroup <> ""
Do
strMembers = inputbox( "Please enter all domain admin members, separated by ','", "Input" )
Loop until strMembers <> ""
If( VerifyGroupMembers( strDomain, strGroup, strMembers ) = True ) Then
WScript.Echo "Check successfull"
Else
WScript.Echo "Check failed"
End If
ADSI sample - checks all members of strGroup. If an element of this group is not member of the strM Comments
No comments yet — be the first to post one!
Post a Comment