Howard, Thank you very much for your reply. I have tried several things in that direction and still no luck. You posted a LDAP query which is similar to what we are doing. I did not know if you may be able to use this as an example...

Break ON

; Create the connection and command object.
$oConnection1 = CreateObject("ADODB.Connection")
? "@error @serror"
$oCommand1 = CreateObject("ADODB.Command")
? "@error @serror"

; Open the connection.
$oConnection1.Provider = "ADsDSOObject" ; This is the ADSI OLE-DB provider name
? "@error @serror"
$oConnection1.Open ("Active Directory Provider")
? "@error @serror"

; Create a command object for this connection.
$oCommand1.ActiveConnection = $oConnection1
? "@error @serror"

; Compose a search string.
$oCommand1.CommandText = "select name, objectClass from 'LDAP://us-tyco-e/DC=us, DC=tycoelectronics, DC=com' " +
"WHERE objectClass='user'" ; and objectClass<>'computer'"

; Execute the query.
$rs = $oCommand1.Execute
? "ex: @error @serror"

;--------------------------------------
; Navigate the record set
;--------------------------------------

While (Not $rs.EOF)
?
for each $item in $rs.Fields
? $item.Name + " = "
$Value = $item.Value
if VarTypeName($Value) = "String"
" " + $Value
else
for each $v in $Value
" " + $v
next
endif
next
;? $rs.Fields("Name")
$rs.MoveNext
Loop

That was your code, but we want to specify credentials for the objects when we query. I was able to modify the connection.open specifying credentials there,

$oConnection1.Open ("Active Directory Provider", $username, $password)

but the .execute of the query fails.

; Execute the query.
$rs = $oCommand1.Execute

Any suggestions?