query active directory in sql 2008

this is the query that i use
SELECT *
  FROM OPENQUERY(ADSI,
       'SELECT  mail, displayName, sAMAccountName, givenName, sn, cn,  userAccountControl
          FROM ''LDAP://yourdomain.com''
          where objectClass = ''User'' order by cn')

and this works fine when i am on the sql server. but if i am on developer machine and use studio management, it gives me this error
An error occurred while preparing the query "SELECT  mail, displayName, sAMAccountName, givenName, sn, cn,  userAccountControl
          FROM 'LDAP://yourdomain.com'
          where objectClass = 'User' order by cn" for execution against OLE DB provider "ADsDSOObject" for linked server "ADSI".


any help is really appreciate
StewSupportAsked:
Who is Participating?
 
Evan CutlerVolunteer Chief Information OfficerCommented:
Hi...
Give this a shot.
http://sql.dzone.com/news/querying-active-directory-thro

it could be a link error in your sql server, or just a querying issue.

Cheers.
0
 
StewSupportAuthor Commented:
what i did to fix my problem is that i went into security in the create new link server wizard and click on the radio button that says use this login and specify the login. thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.