#40345 - 2003-05-1703:36 AMMore on perceived FILTER problem
Howard BullockHoward Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I think I have uncovered some pertinent data regarding the perceived ADSI filter issue where computers are returned when the FILTER is set to "user" as seen in thread:
Using an alternative method (ADODB) to query the "users" from Active Directory I have discovered that an object seems to have an array of CLASS attributes. A user has shows these class attributes: top person organizationalPerson user while a computer object has these: top person organizationalPerson user computer.
With the above info I can see why ADSI is returning both users and computers when the FILTER is set to "user".
You can gather your own data with the following code.
[ 17. May 2003, 03:55: Message edited by: Howard Bullock ]
#40347 - 2003-05-1707:03 PMRe: More on perceived FILTER problem
Howard BullockHoward Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
More info (From Steve @ Microsoft):
quote:What you are finding is correct. The Computer class is based on the User class, so if you filter on 'User' in the IADsContainer::Filter, it will also display the Computers located in that container. The reason the opposite is not true, is that the User does not have an entry for 'Computer' in it's objectClass attribute.
Unfortunately, the filter only will filter on the objectClass rather than the objectCategory, so this filter will not distinguish between User and Computer objects. If you have containers that have both User and Computer objects in it, I would work around it using one of the following techniques:
1. When looping through the objects in the IADsContainer object, check the objectCategory value and ensure it is Person. 2. Use ADO with the ADsDSoObject and execute a one level search on that container, filtering on objectCategory='Person'.
I am attaching a sample script that I had lying around that shows querying on the objectCategory. For further information concerning using the ADSI OLE-DB provider with ADO, please see the information at the following MSDN link.