Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Linked Server error while querying Active Directory

Posted on 2009-06-30
4
Medium Priority
?
4,331 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 160 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

636 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