Querying AD
- From: "Jim in Arizona" <tiltowait@xxxxxxxxxxx>
- Date: Tue, 1 Apr 2008 09:13:38 -0700
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
- From: Joseph T Corey
- Re: Querying AD
- From: Joe Kaplan
- Re: Querying AD
- Prev by Date: Loopback Policy not working
- Next by Date: Anyone on the group familiar with Windows Server Performance Advisor?
- Previous by thread: Loopback Policy not working
- Next by thread: Re: Querying AD
- Index(es):
Relevant Pages
|