I've created a linked server pointing our AD to create some reports.
the query to retrive the info is this one:
SELECT * FROM OpenQuery ( ADSI, 'SELECT mail ,mobile ,telephoneNumber ,title ,sn ,givenName ,SAMAccountName FROM ''LDAP://MyDomain.local/OU=MyOU,DC=MyDomain,DC=LOCAL'' WHERE objectClass = ''user'' AND NOT objectClass = ''computer'' ' ) AS tblADS ORDER BY SAMAccountName
and Im receiving the famous error:
Msg 7399, Level 16, State 1, Line 1 The OLE DB provider "ADsDSOObject" for linked server "ADSI" reported an error. The provider indicates that the user did not have the permission to perform the operation.
Security tab has the most powerfull user we have, with access to everything. just as a try we gave max permissions to AD to the login running sql server. nothing can solve this issue.
I'm looking for answers for 2 days over the internet but all answers are like typos, or users with 0 permissions.