Monday morning.....

Getting there slowly

I'm getting stuck with these AD queries and I think I'm making errors in the LDAP:// part in the command. Suppose I want to check the value of location for all printers connected to a system here:

OU=servers, OU=Computers Group, DC=domname, dc=compname, dc=nl (In the root is OU 'Computers group', then servers and under servers are the computers.
Quote:


$LD="OU=servers, OU=Computers Group, DC=domname, dc=compname, dc=nl"
"SELECT Name from 'LDAP://" + $LD + "'" + " WHERE objectCategory='printQueue' AND Location='" + $Location + "'"
$objRecordSet = objCommand.Execute()
While Not $objRecordSet.EOF
$Test1 = $objRecordSet.Fields("Name").Value
? "printer found"
$objRecordSet.MoveNext
loop





The printer found message is never displayed. $Location var is correct, I tested that and I think something is not right in my query.

Tx
Henk