?
Solved

Linked Server error while querying Active Directory

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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 …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

764 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