SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Linked server to AD


Linked server to AD

Author
Message
Ford Fairlane
Ford Fairlane
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3316 Visits: 836
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





Orlando Colamatteo
Orlando Colamatteo
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40854 Visits: 14413
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
Ford Fairlane
Ford Fairlane
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3316 Visits: 836
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





Orlando Colamatteo
Orlando Colamatteo
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40854 Visits: 14413
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search