Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Linked server to AD Expand / Collapse
Author
Message
Posted Wednesday, August 15, 2012 10:04 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, August 11, 2014 12:00 AM
Points: 1,691, Visits: 757
Hi,

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',
@datasrc=N'RHSPWDCOC02'
GO

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]

From OpenQuery

( ADSI,'SELECT name, displayname FROM ''ADSI://RHSPWDCOC02''

WHERE objectCategory = ''Person'' AND objectClass = ''user''')

OUTPUT:
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...

Ford Fairlane
Rock and Roll Detective





Post #1345647
Posted Thursday, August 16, 2012 1:10 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:34 AM
Points: 7,097, Visits: 12,601
Try it with LDAP instead of ADSI:

Select [Name] ,[DisplayName] 

From OpenQuery

( ADSI,'SELECT name, displayname FROM ''LDAP://RHSPWDCOC02''

WHERE objectCategory = ''Person'' AND objectClass = ''user''')



__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1346211
Posted Thursday, August 16, 2012 5:42 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, August 11, 2014 12:00 AM
Points: 1,691, Visits: 757
Hi,

Thanks for the advice. I found the problem to be a security issue AND the fact that the MaxPageSize is limited to 901 and I was pulling down more than that. I found the solution [color=#FF0000]here [/color]which worked a treat.


Hope this helps...

Ford Fairlane
Rock and Roll Detective





Post #1346293
Posted Thursday, August 16, 2012 9:13 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:34 AM
Points: 7,097, Visits: 12,601
I did not have any luck using ADSI:// myself. Only when switching to use LDAP:// did it work although it sounds like you had a few things going on simultaneously. I see the article used LDAP:// as well. Happy you got it all sorted.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1346317
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse