Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Active Directory > Re: LDAP Query for memeber of one group

Reply
Thread Tools Display Modes

Re: LDAP Query for memeber of one group

 
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      03-04-2009
Victor wrote:

> I'm trying to set a saved query that will return the members of on
> group.
> So I've created the follwing query to get all the users which are
> member of the *group* Internet from the *domain* mydomain.local in the
> *OU* Bucharest
>
> -(&(&(objectCategory=person)(|(objectClass=contact) (objectClass=user))(memberOf=cn=Internet,ou=Buchar est,dc=mydomain,dc=local)))-
>
> But I get nothing.
> Some help...
>


It looks like you want users and contacts that are direct member of the
group. I would try:

(&(objectCategory=person)(memberOf=cn=Internet,ou= Bucharest,dc=mydomain,dc=local))

The clause (objectCategory=person) will return user and contact objects.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


 
Reply With Quote
 
 
 
 
Paul Bergson [MVP-DS]
Guest
Posts: n/a

 
      03-04-2009
My guess is you have the Distinguished Name (DN) wrong. Go into ADSIEdit
and verify that the DN you have in your script matches the actually defined
DN of the object.

--
Paul Bergson
MVP - Directory Services
MCTS, MCT, MCSE, MCSA, Security+, BS CSci
2008, 2003, 2000 (Early Achiever), NT4

http://www.pbbergs.com

Please no e-mails, any questions should be posted in the NewsGroup This
posting is provided "AS IS" with no warranties, and confers no rights.


"Richard Mueller [MVP]" <rlmueller-> wrote in
message news:e%...
> Victor wrote:
>
>> I'm trying to set a saved query that will return the members of on
>> group.
>> So I've created the follwing query to get all the users which are
>> member of the *group* Internet from the *domain* mydomain.local in the
>> *OU* Bucharest
>>
>> -(&(&(objectCategory=person)(|(objectClass=contact) (objectClass=user))(memberOf=cn=Internet,ou=Buchar est,dc=mydomain,dc=local)))-
>>
>> But I get nothing.
>> Some help...
>>

>
> It looks like you want users and contacts that are direct member of the
> group. I would try:
>
> (&(objectCategory=person)(memberOf=cn=Internet,ou= Bucharest,dc=mydomain,dc=local))
>
> The clause (objectCategory=person) will return user and contact objects.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>


 
Reply With Quote
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      03-04-2009

"vop" <> wrote in message
news:...
>
> Hello Paul, thanks for the reply it was very helpful.
>
> OK, so I've installed ADSIEdit and after I got all correct DN's I came
> up with this:
>
> (&(objectCategory=person)(memberOf=CN=Internet,CN= Users,DC=mydomain,DC=local))
>
> .and it works I've got al lthe members of the group Internet.
>
> But this users are spread in more then 50 OU's. How can I add a
> condition to narrow down to the users that are members of the group
> Internet but under a specific OU?
>
> I've tried this but it dose not work:
>
> (&(&(objectCategory=person)(memberOf=CN=Internet,C N=Users,DC=mydomain,DC=local)(OU=Bucharest,OU=Coun try,OU=Company,OU=Organisation,DC=mydomain,DC=loca l)))
>
> Thanks a lot.
>


Filtering on OU cannot be done because it is not an attribute of the user
object (you can see all attributes in ADSI Edit). The only way to do this is
to set the "Base" of the search to the DN of the OU.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


 
Reply With Quote
 
Paul Bergson [MVP-DS]
Guest
Posts: n/a

 
      03-05-2009
I had run into the exact same issue yesterday, but as Richard said it is not
possible.

--
Paul Bergson
MVP - Directory Services
MCTS, MCT, MCSE, MCSA, Security+, BS CSci
2008, 2003, 2000 (Early Achiever), NT4

http://www.pbbergs.com

Please no e-mails, any questions should be posted in the NewsGroup This
posting is provided "AS IS" with no warranties, and confers no rights.


"vop" <> wrote in message
news:...
>
> Hello Paul, thanks for the reply it was very helpful.
>
> OK, so I've installed ADSIEdit and after I got all correct DN's I came
> up with this:
>
> (&(objectCategory=person)(memberOf=CN=Internet,CN= Users,DC=mydomain,DC=local))
>
> .and it works I've got al lthe members of the group Internet.
>
> But this users are spread in more then 50 OU's. How can I add a
> condition to narrow down to the users that are members of the group
> Internet but under a specific OU?
>
> I've tried this but it dose not work:
>
> (&(&(objectCategory=person)(memberOf=CN=Internet,C N=Users,DC=mydomain,DC=local)(OU=Bucharest,OU=Coun try,OU=Company,OU=Organisation,DC=mydomain,DC=loca l)))
>
> Thanks a lot.
>
>
> --
> vop
> ------------------------------------------------------------------------
> vop's Profile: http://forums.techarena.in/members/vop.htm
> View this thread: http://forums.techarena.in/active-directory/1134186.htm
>
> http://forums.techarena.in
>


 
Reply With Quote
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      11-27-2009

"rommel543" <> wrote in message
news:...
>
> I'm having a similar issue, except I'm attempting to pull ALL users from
> AD except the ones in a specific group.
>
> (&(objectCategory=Person)(objectClass=User)(!membe rOf=CN=GroupToExclude,CN=General,CN=Security
> Groups,OU=*corporate,OU=base,DC=domain,DC=com))
>
> I did up a quick LDAP query test and found that I'm able to pull out or
> filter users with the following:
>
> (&(objectCategory=Person)(objectClass=User)(member Of=CN=TestSharepointGroup,CN=Users,DC=domain,DC=co m))
> (&(objectCategory=Person)(objectClass=User)(member Of=CN=Alberta
> Region,CN=Region Distribution List,CN=Email
> Distribution,OU=base,DC=domain,DC=com))
>
> I picked a different group with in the same container as the problem
> group and found this DOES NOT work:
>
> (&(objectCategory=Person)(objectClass=User)(member Of=CN=differnetGroup,CN=General,CN=Security
> Groups,OU=*corporate,OU=base,DC=domain,DC=com))
>
> Can anyone point to any issue with the query, or a possible issue with
> a ldap query to nested OUs?
>
>


Wildcard characters are not allowed in DN attributes, like memberOf
(assuming that's the purpose of the "*" character). If there are three OU's
with groups of the same name, you can AND 3 clauses, each of which specifies
the full DN of a group.

If the DN value itself includes a "*" character, it must escaped by
replacing it with "\2A".

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ldap query for group members Joe Active Directory 2 04-19-2011 01:21 PM
Account Group Membership Visible in Active Directory Users and Computers but not Found in LDAP Query dln Windows Server 3 01-14-2009 08:00 PM
Re: LDAP query can it be done ? Jorge Silva Active Directory 1 11-13-2008 12:20 AM
Re: LDAP query based group in ADAM Lee Flight Active Directory 0 02-16-2006 02:18 PM
LDAP Query Joe Richards [MVP] Active Directory 2 06-20-2005 03:41 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59