Our forums are currently in maintenance mode and the ability to post is disabled. We will be back up and running as soon as possible. Thanks for your patience!

General discussion


LDAP Find users within a group

By banx ·
Using ADUC I tried to find which users were members of the Internet group using:
Removing the "CN=" still results in a "is not a valid query string" How do I find out which users are members of a particular group ??
All help appreciated,

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by faradhi In reply to LDAP Find users within a ...

The members of a group are stored in a delimited property of the group.

Here is a VBScript that will enumerate the members of a group.

Option Explicit
Dim strMember, strDNSDomain, strContainer
Dim objGroup, objRootDSE
Dim arrMemberOf, arrCPU

' Bind to Active Directory'
strContainer = "cn=AllWorkstations,cn=Computers, " 'Change this to the group in question
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")

' Get the group
Set objGroup = GetObject ("LDAP://"& strContainer & strDNSDomain)

arrMemberOf = objGroup.GetEx("member") 'Loads group into an Array

' Loop = For Each .... Next
WScript.Echo "Members of Group " & strContainer
For Each strMember in arrMemberOf
arrCPU = Split(strMember,",") 'Splits the member which is listed as Distinguished name
WScript.echo Right(arrCPU(0), Len(arrCPU(0))-3) 'Takes the computer name and removes the "CN=" part.


Collapse -

by banx In reply to LDAP Find users within a ...

Thanx for taking the time to reply. VBS scripting is not one of my secialities but have passed it on to a colleague to make sense of it for me. Will advise on how i get on.


Collapse -

Need Some help with aquery

by gerardo.tiscareno@gmail. In reply to

I have the same problem but i want to do is a report in crystal with the same type of query, can please some one help me

Collapse -

by slotbumwaller In reply to Need Some help with aquer ...

Try this:


Collapse -

by sysoevpa In reply to

It is work! Right for Crystal Report this LDAP:

SELECT name FROM 'LDAP://dc=domain,dc=com'
objectClass = 'user' and memberOf='CN=Group,OU=Groups,DC=domain,DC=com'

Related Discussions

Related Forums