' **********************************************************
' Tel het aantal leden in een AD-groep.
'
' Auteur: Ivo Dijkgraaf
' Datum: 05-03-2012
'
' Historie: 05-03-2012 ID - Initieel
'
' **********************************************************
Dim intMemberCount
strSourceGroupDN = "CN=GAP_XMLSPY_BANK,OU=Applicaties,OU=Groups,OU=SNS Bank,OU=Bedrijven,DC=VERZ,DC=LOCAL"
''strSourceGroupDN = InputBox ("Enter the DN of Source Group")
MsgBox CountMembers("LDAP://" & strSourceGroupDN) & " members in Group " & strSourceGroupDN
If Err.Number <> vbEmpty Then
Call ErrorHandler("Could not get Group Members.")
End If
Function CountMembers (strGroupADsPath)
Set objGroup = GetObject(strGroupADsPath)
intMemberCount = 0
For Each objMember In objGroup.Members
intMemberCount = intMemberCount + 1
Next
CountMembers = intMemberCount
End Function
'****************************************************************
' This function handles errors that occur in the script.
'****************************************************************
Sub ErrorHandler( errorText )
''WScript.Echo(vbcrlf & errorText)
''WScript.Echo("Error number: " & Err.number)
''WScript.Echo("Error Description: " & Err.Description)
Err.Clear
End Sub