I am performing a GetObject on a known OU in AD and do not ever get from a "computer".

Let's just work with the OU loop.

If I comment out the filter I get output. When I use the Filter the script dies. I should be able to enumerate the OU hierarchy with this code.

code:
break on

EnumOUsForComputers("LDAP://us-tyco-e/OU=NCS, OU=Machines, DC=us, DC=tycoelectronics, DC=com", "computer");

Function EnumOUsForComputers($LDAP, $Filter)
;$Filter = 'computer' | 'user'
dim $pos
$objOU = GetObject($LDAP);
"LDAP string='$LDAP'" ? ?
if VarTypeName($objOU)='Object'
; $objOU.Filter = $Filter,""
; for each $item in $objOU
; $Name = $item.Name
; "@error $Name " + $objOU.class ?
; substr($Name,4,instr($Name,"/")-1) ?
; next
;$objOU.Filter = "organizationalUnit",""
for each $item in $objOU
$Name = $item.Name
$pos = instr($LDAP,"OU=")
$DN = Left($LDAP,$pos-1) + $Name + ", " + substr($LDAP, $pos)
EnumOUsForComputers($DN, $Filter);
next
else
"GetObject COM error: " + @error + " " + @serror
endif
Endfunction




[ 13 June 2002, 17:55: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/