I am trying to query our AD with LDAP through a linked server in SQL Server 2008 R2. This is what I have done so far;
EXEC master.dbo.sp_addlinkedserver @server = N'ADSI',
@srvproduct=N'Active Directory Services', @provider=N'ADsDSOObject',
For security I am using my account which is a domain admin to access the server and log into SQL Server.
I run :
Select [Name] ,[DisplayName]
( ADSI,'SELECT name, displayname FROM ''ADSI://RHSPWDCOC02''
WHERE objectCategory = ''Person'' AND objectClass = ''user''')
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "SELECT name, displayname FROM 'ADSI://RHSPWDCOC02'
WHERE objectCategory = 'Person' AND objectClass = 'user'" for execution against OLE DB provider "ADsDSOObject" for linked server "ADSI".
Any ideas as to what I am missing ???
Hope this helps...
Rock and Roll Detective