Hi everybody,

Why doesn't this code work ? This code searches users in OU
and prints the sAMAccounteName of users who respect criteria.

'''--------------------------------------------
ldap_adress = "LDAP://OU=comptes, OU=MesUtilisateurs,
DC=yourcenar, DC=lyc"

Set objConnection = Wscript.createObject("ADODB.Connection")
Call objConnection.open ("Provider=ADsDSOObject;")
Set objCommand = Wscript.createObject("ADODB.Command")
objCommand.activeConnection = objConnection
objCommand.commandText = _
"<" & ldap_adress & ">;" & _
"(ObjectCategory=user);" & _
"samaccountname,description;" & _
"subtree"
Set objRecord = objCommand.execute
objRecord.moveFirst

Wscript.echo objRecord.RecordCount 'Give 644 records

Do
'objRecord.find("samaccountname LIKE 's*'")'<----OK!
objRecord.find("description LIKE 'p*'") '<----BOUM!!!
If objRecord.absolutePosition > 0 Then
Wscript.echo objRecord.fields("samaccountname").Value
objRecord.moveNext
End If
Loop While objRecord.absolutePosition > 0
'''--------------------------------------------



With the criterion about "samaccountname", there is no
problem, but why doesn't the equivalent criterion about
"description" work and how can I solve my problem ?

Thank you for your help.


--
François Lafont