I am using this query:
<cfldap name="qGetUsers"
server="myServer"
action="query"
attributes="sAMAccountName"
scope="subtree"
start="ou=-hnmc,dc=hnmc,dc=com"
filter="(&(objectClass=User))"
username="#dclogin_username#"
password="#dclogin_password#"
<cfoutput query="qGetUsers">
#sAMAccountName#<br>
</cfoutput>
The problem is that it returns both Users and Computer Names. How do I get it
to return just the usernames. And also...
how do I drop this information into a database table (SQL 2000)....?
Thanks,
Jones
Adam Cameron - 27 Dec 2004 21:56 GMT
> filter="(&(objectClass=User))"
Your guess is as good as mine as to why, but "computers" are also in the
objectClass "user".
I would instead filter on objectCategory instead; it seems to make the
differentiation that you want.
A very handy tool for investigating these things is Softerra's LDAP
Browser... it's a lot easier for poking around the place than using CFLDAP,
and you can run test queries on it and such like. Great tool.
> how do I drop this information into a database table (SQL 2000)....?
Err...
Loop over it, insert it into the DB.
Not sure there's a quicker way.
Although maybe there's an LDAP connector for MS-SQL 2k? Might be worth
looking at.

Signature
Adam
cgsj_usa@yahoo.com - 28 Dec 2004 14:44 GMT
Try outputing the samAccountType, and see if that gives you a distinction
between username and computername. I think that it does, but I don't remember
which value it is. Then, you can use that attribute/value pair as your filter.
To input this data into a SQL table, simply loop through the query
("qGetUsers") and insert into a table.
Hope that this helps. Thanks.
CHris
Adam Cameron - 28 Dec 2004 19:49 GMT
> filter="(&(objectClass=User))"
Your guess is as good as mine as to why, but "computers" are also in the
objectClass "user".
I would instead filter on objectCategory instead; it seems to make the
differentiation that you want.
A very handy tool for investigating these things is Softerra's LDAP
Browser... it's a lot easier for poking around the place than using CFLDAP,
and you can run test queries on it and such like. Great tool.
> how do I drop this information into a database table (SQL 2000)....?
Err...
Loop over it, insert it into the DB.
Not sure there's a quicker way.
Although maybe there's an LDAP connector for MS-SQL 2k? Might be worth
looking at.
--
Adam