Okay, I think this should work. Thanks for your great assistance!!

About 200 groups will be created when I hit enter. I'd better test just a bit more....

code:
;http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=1;t=007920

call @ScriptDir+'\CreateAdGroup.udf'

;********** Beginning of group creation *********
$printers = GetObject("LDAP://OU=Printers,DC=test,DC=local")

if @error
? @serror
else

for each $printer in $printers
$printername = $printer.name
$printername = substr($printername,4)

if left($printername,7) = "MRH-01-"
$printername = lcase(substr($printername,8))

$defprintgroup = "DefPrinter_mrh-01_"+$printername
$DN_ofOU ="OU=Printer Groups,DC=test,DC=local"
$rc=CreateAdGroup($DN_of_OU, $defprintgroup, "global", 0, "Default Printer")

$addlprintgroup = "AddlPrinter_mrh-01_"+$printername
$rc=CreateAdGroup($DN_of_OU, $addlprintgroup, "global", 0, "Additional Printer")

? $defprintgroup ; write output to file for now
endif

next

endif



[ 14. October 2003, 20:39: Message edited by: tjcarst ]