Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return OU using SQL statement

Status
Not open for further replies.

PawelTru

Programmer
Jul 18, 2002
24
0
0
US
I am trying to get the OU from AD using the following query:

SELECT * FROM OPENQUERY(ADSI,
'<LDAP://DC=test,DC=COM>;(&(objectCategory=Person)(objectClass=user)); ou, sAMAccountName, givenName, sn, name, PhysicalDeliveryOfficeName, homedirectory, telephoneNumber, department, mail,info, adspath;subtree')

The problem is that it returns null for all.
 
>[tt](&(objectCategory=Person)(objectClass=user))[/tt]
Simply search for ou?
[tt](objectCategory=organizationalUnit)[/tt]
But looking at what attributes you try to return, maybe I misunderstand the question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top