I am using a linked server to query Active directory and
SELECT * FROM OpenQuery(ADSI,'<LDAP://skolhem1/DC=skola,DC=sundsvall,dc=local>;(&(objectCategory=Person)(objectClass=user));name, adspath;subtree') where name='be89mape'
does work when I ask for one of the first 1000 users but not if I ask for any of the others. What I want to do is to compare the OU that is stored in the SQL-server with the OU the user actually belongs to in AD so that is why I don't want to give the ou in the LDAP-string.
I hope you understand the question...