Re: Querying AD
- From: "Joseph T Corey" <jcorey@xxxxxxxxxxxxxx>
- Date: Tue, 1 Apr 2008 13:20:25 -0400
Maybe you just mistyped, but if testou2 in "inside" of testou1, the LDAP filter should be:
"(&(sAMAccountName=tuser)(memberOf=CN=testgroup,OU=testou2,OU=testou1,DC=corp,DC=mydomain,DC=com))"
The code you posted had testou1 as a sub OU of testou2.
--
Joseph T. Corey MCSE, Security+
Systems Administrator
jcorey@xxxxxxx
"Jim in Arizona" <tiltowait@xxxxxxxxxxx> wrote in message news:%23oDmZNBlIHA.1164@xxxxxxxxxxxxxxxxxxxxxxx
Although I'm wrting VB.NET code, the part of the code I'm in need of help on is AD querying so I figured this group would be more appropriate for the question.
I'm trying to query AD to see if a username is a member of a group. For some reason, it only works in a top level OU. Anything below that and it does not work.
The Problem:
I have a top level OU called testou1. Inside that OU is a group called testgroup. Within that group is a single user called testuser.
If I run this code (code snipped for brevity), it returns a positive result by writing the users username to the screen:
osearcher.Filter = "(&(sAMAccountName=tuser)(memberOf=CN=testgroup,OU=testou1,DC=corp,DC=mydomain,DC=com))"
The above returns the user just fine. Now, if I have a second ou called testou2 that inside testou1, and I move the group called testgroup from the OU testou1 to the OU testou2 and I try this code:
osearcher.Filter = "(&(sAMAccountName=tuser)(memberOf=CN=testgroup,OU=testou1,OU=testou2,DC=corp,DC=mydomain,DC=com))"
I get nothing returned from the query.
I'm hoping someone can clue me in.
TIA,
Jim
.
- Follow-Ups:
- Re: Querying AD [RESOLVED]
- From: Jim in Arizona
- Re: Querying AD [RESOLVED]
- References:
- Querying AD
- From: Jim in Arizona
- Querying AD
- Prev by Date: Re: Querying AD
- Next by Date: Re: Querying AD
- Previous by thread: Re: Querying AD
- Next by thread: Re: Querying AD [RESOLVED]
- Index(es):
Relevant Pages
|