Here's the skeleton for a generic domain / server object browser:

By testing the class property of domain objects, one can drill-down to just groups, users, computers or services.

For example:

kix32 enum.kix $domain=mydomain $class=user
kix32 enum.kix $domain=mydomain $class=group
kix32 enum.kix $domain=mydomain $class=computer
kix32 enum.kix $domain=myhost $class=service
kix32 enum.kix $domain=myhost $class=group

Obviously this won't work:

kix32 enum.kix $domain=mydomain $class=service

Because services are machine objects, not domain objects

code:

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


Shawn.

[This message has been edited by Shawn (edited 14 August 2000).]