Solved

Linked Server error while querying Active Directory

Posted on 2009-06-30
4
3,431 Views
Last Modified: 2012-05-07
I am trying to query Active Directory using Linked Server using the following code in SQL Server 2008:

--Creation of Linked Server
EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5',
'ADSDSOObject', 'adsdatasource'
GO
The above statement is successfully executed.

--Querying the Active Directory
select * from openquery(ADSI,'SELECT name, cn, givenName, description
FROM ''LDAP://test1.com/DC=test1,DC=com''
WHERE objectCategory = ''Person'' AND objectClass = ''user''')

The error which I get when executing the above query is:
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "ADSDSOObject" for linked server "ADSI" reported an error. The provider indicates that the user did not have the permission to perform the operation.
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "SELECT name, cn, givenName, description
FROM 'LDAP://test1.com/DC=test1,DC=com'
WHERE objectCategory = 'Person' AND objectClass = 'user'" for execution against OLE DB provider "ADSDSOObject" for linked server "ADSI".

Please suggest me to resolve the above error.

Thanks
0
Comment
Question by:nag_damg
  • 2
4 Comments
 

Author Comment

by:nag_damg
ID: 24744026
How can i authenticate so there would be no permission error?
0
 

Author Comment

by:nag_damg
ID: 24751890
Is there any other alternative?
0
 
LVL 42

Accepted Solution

by:
Eugene Z earned 40 total points
ID: 24756903
<The provider indicates that the user did not have the permission to perform the operation.>
set the linked server to run  Domain login ...

 
also check
Querying Active Directory Through SQL Server Submitted by Boyan  
http://sql.dzone.com/news/querying-active-directory-thro 
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question