Solved

Linked Server error while querying Active Directory

Posted on 2009-06-30
4
2,955 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:
EugeneZ 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now