In tip 9690, we returned user properties using the LDAP provider.

GroupMembers.vbs is a sample script that returns the members of a domain group.

The syntax for using GroupMembers.vbs is:

CScript.exe //nologo <Drive:>\<FolderName>\GroupMembers.vbs <distinguishedName_Of_Group>


cscript //nologo c:\util\GroupMembers.vbs "CN=R&D,CN=Users,DC=JSIINC,DC=COM"
GroupMembers.vbs contains:
                              Dim objArguments, strDomainGrp                              Set objArguments = Wscript.Arguments                              If WScript.Arguments.Count = 0 then Wscript.Quit                              strDomainGrp=objArguments(0)                              On Error Resume Next                              Set objGroup = GetObject("LDAP://" & strDomainGrp)                              objGroup.GetInfo                              arrMemberOf = objGroup.GetEx("member")                              For Each strMember in arrMemberOf                                  WScript.echo 
" & strDomainGrp &
& strMember &
" Next