I have a linked server to the ADSI and I am using the following query to list the users on our active directory...
select displayname from openquery
(
ADSI,'SELECT displayname, logoncount
FROM ''LDAP://**.********.com''
WHERE objectCategory = ''Person'' AND objectClass = ''user'''
)
WHERE displayname IS NOT NULL
AND logoncount IS NOT NULL
AND logoncount > 0
order by displayname
The problem is that even though I am checking that it is a person and a user some groups are being listed in the results. As you can see. I have resorted to using logoncount to seperate a few out but this still shows some groups and exchange mailboxes.
Is there any definitive way, in ADSI, to identify a user?
Thanks in advance.
Tom.
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).