ADSI User List

sql server United Kingdom
  • 13 years ago

    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.

     

     

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC. As potential programmers, they are mentally mutilated beyond hope of regeneration.” - E. W. Dijkstra