That query will get you more than users - also groups. If all youw ant is users, you can simplify it to "(&(objectCategory=person)(objectClass=user))". If you want groups too, "(|(&(objectCategory=person)(objectClass=user))(&(objectCategory=group)(objectClass=group)))"
Look at adfind as Michael suggested. You can use the incldn and excldn switches if you wanted and search the whole domain but only include certain OUs Thanks, Brian Desmond [email protected] c - 312.731.3132 > -----Original Message----- > From: Robert Smith [mailto:[email protected]] > Sent: Thursday, February 25, 2010 6:34 PM > To: NT System Admin Issues > Subject: Re: LDAP Query across Multiple OU's > > We are trying to get all of our users in all OUs, and it needs to be done in > LDAP. that query will return all the users from one specific OU, but not all > users in all OUs in a domain. > > Thanks, > Bob > > On Thu, Feb 25, 2010 at 4:30 PM, Brian Desmond > <[email protected]> wrote: > > That is a weird looking query. What are you trying to get out of it? > > > > Thanks, > > Brian Desmond > > [email protected] > > > > c - 312.731.3132 > > > > > >> -----Original Message----- > >> From: Robert Smith [mailto:[email protected]] > >> Sent: Thursday, February 25, 2010 5:44 PM > >> To: NT System Admin Issues > >> Subject: LDAP Query across Multiple OU's > >> > >> Hello, > >> > >> Is there any way to do an LDAP query for users across multiple OU's > >> via Saved Queries in ADUC? We are able to perform the custom search > >> below with the following LDAP queries, but this is only for one OU at > >> a time, we would like to be able to select a few at a time out of > >> almost a hundred OU's > >> > >> > (&(|(&(objectCategory=person)(objectSid=*)(!samAccountType:1.2.840.11 > >> 3 > >> 556.1.4.804:=3))(&(objectCategory=person)(!objectSid=*))(&(objectCate > >> gor > >> y=group)(groupType:1.2.840.113556.1.4.804:=14)))) > >> > >> > >> Thanks! > >> Bob > >> > >> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ > >> <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > > > > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ > > <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > > > > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ > <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~
