Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Active Directory Linked servers

Author  Topic 

vibha
Starting Member

7 Posts

Posted - 2008-04-19 : 07:33:19
I want the list of Users from Active Directory.I have created the linked server in SQL 2005.After that I queried

SELECT *
FROM OPENQUERY (ADSI,
'SELECT givenName, sn FROM LDAP:// DC=xxx,DC=COM')


I got following error message.

An error occurred while preparing the query "select givenname,sn from 'LDAP://xxx.COM'" for execution against OLE DB provider "ADSDSOObject" for linked server "ADSI".

what are the security settings and permissions required to set?

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-04-19 : 17:58:21
How did you set security in linked server?
Go to Top of Page

vibha
Starting Member

7 Posts

Posted - 2008-04-21 : 02:10:33
quote:
Originally posted by rmiao

How did you set security in linked server?




By right cliking on linked Server in SQL 2005 i selected the Properties->Security->"Be made using this security context".Gave Remote Login and Password of Active Directory server.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-04-21 : 23:32:56
Does that account have required permission in ads?
Go to Top of Page

vibha
Starting Member

7 Posts

Posted - 2008-04-22 : 02:58:27
I got list of users who are in Active Directory.But password field values are displayed as Nullthough the users are having passwords in ADS.Is there any other field except 'userpassword'
for password?

SELECT mail AS Email,sAMAccountName AS UserName,userpassword AS Password

FROM OPENQUERY
( ADSI,
'SELECT
mail,
sAMAccountName,
userpassword

FROM ''LDAP://DC=MIDCPRO,DC=COM''

WHERE objectClass=''Person''
AND objectClass = ''User'''
)
WHERE
sAMAccountName IS NOT NULL
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-05-03 : 20:32:46
Doesn't think you can get password.
Go to Top of Page
   

- Advertisement -