ActiveXperts.com » Administration » Scripts » Adsi » Check Domain Admin- or Enterprise Admin membership - vbscript

Check Domain Admin- or Enterprise Admin membership - vbscript

Active Directory Services Interface (ADSI) is a set of COM (Common Object Model) programming Interfaces. Like ODBC, ADSI provides common access to directories by adding a provider for each directory protocol type.

You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.

On this site, you can find many ADSI samples.

The check-domain-admin-or-enterprise-admin-membership ADSI class can be used in ActiveXperts Network Monitor to monitor your servers.


Example(s)

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
M