![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Problem with searh ADO in Active directory on Windows 2000 server 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 |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Access Active directory with sql server in powershell | PowerShell | |||
| Virtualise Windows 2008 Server Active Directory | Virtual Server | |||
| Windows Server 2003 Ent Edition Active Directory | .NET General | |||
| Active Directory Connection - Exchange / Server 2003 | Vista General | |||
| Group Policy for Vista in Windows 2000 Active Directory Domain | Vista General | |||