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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LINKING USING LDAP TO ADSI

Status
Not open for further replies.

Sammy145

Programmer
Oct 4, 2002
173
GB
Hi i want to query the active directory on windows 2000
I dont mind what method but must be in SQL
and get all the group Names from teh DOMAIN [QC] and Populate a table with the Group names can Someone show me how to do this


Sam
 
I don't know of any way to do it directly from T-SQL. In VB I use the an ADSI interface using GetObject() to access the Active Directory but cannot find GetObject() in T-SQL. T-SQL appears to only support CreateObject() using a sproc. Read up on the OLEDB driver for active directory. This might give you what you need. You can use it in conjunction with ADO.


Chris.
 
Why does it need to be in SQL?

Why can't you use a program that will connect to the database and populate the table with the information retrieved from LDAP?
 
i Just thought it would be a good way and faster way rather than writing an exe or dll to do it

Can you tell me why not to do it in SQL server
can it be done in SQL server
Its a microsoft product!


Sam
 
I tried recently to retrieve even just an NT/2000 user name before, and that cant even be done (unless they are logged on using Windows authentication). I just dont think this information is passed to SQL at any point
 
cant i use linked server?
if so can someone tell me how to set this up

sam
 
Were using QSL 2K
I'm trying to get employee names out of ActiveDirectory and have not totally completed this task yet, but the following has extracted the basics. Maybe it will give you a start.

sp_addlinkedserver 'ADSI','Active Directory Services 2.5','ADSDSOObject','adsdatasource'


SELECT * FROM OpenQuery(ADSI,'<LDAP://??????? DC=QC >;(&(objectCategory=Person)(objectClass=user));name,userAccountControl,sAMAccountName,sn,givenname,DisplayName,WhenCreated,adspath;subtree')


?????? is the servername

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top