Solved

Linked Server error while querying Active Directory

Posted on 2009-06-30
4
3,698 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 43

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

695 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