break on
; How to use ADSI to enumerate all objects in your domain
; usage: kix32 enum.kix $domain=domain $class=object [$pipe=filename]
; where $domain = your domain or hostname
; where $class = user, group or service
if $domain
else
$domain = "@ldomain"
endif
if $class
else
$class = "group"
endif
$container = olegetobject ( 0, "WinNT://$domain" )
if $container = 0
"Active Data Services Interface (ADSI) not installed on this machine"
exit
endif
if $pipe
del "$pipe"
$rs = redirectoutput ( "$pipe" )
endif
?"Enumerating all $class's in $domain ..."
?
$objects = oleenumobject( $container )
$object = oleenumobject ( $container, $objects )
while $object <> 0
if $object and olegetproperty ( $object, "class" ) = "$class"
?
?"Name :" olegetproperty ( $object, "name" )
?"Remark:" olegetproperty ( $object, "description" )
endif
$rs = olereleaseobject ( $object )
$object = oleenumobject( $container, $objects )
loop
if $objects
$rs = olereleaseobject ( $objects )
endif
if $container
$rs = olereleaseobject ( $container )
endif
?
exit