#134847 - 2005-03-07 08:59 AM
Re: Querying the active directory
|
HeartCore
Fresh Scripter
Registered: 2005-03-01
Posts: 17
|
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
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|