Okay - now I get

CreateAdGroup Failed with Error: -2147352567

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

call @ScriptDir+'\CreateAdGroup.udf'

;********** Beginning of group creation *********

$logfile=c:\printers.xls
$printers = GetObject("LDAP://OU=Printers,DC=test,DC=local")
$DN_of_OU ="OU=Printer Groups,DC=test,DC=local"

if @error
? @serror
else

$rc=redirectoutput($logfile,1)

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

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

$printername = lcase(substr($printername,8))

$defprintgroup = "D_mrh-01_"+$printername


if CreateAdGroup($DN_of_OU, $defprintgroup, "global", 1, "Default Printer")
? "Group successfully created"
else
? "CreateAdGroup Failed with Error: " + @error
endif


$addlprintgroup = "A_mrh-01_"+$printername

? $addlprintgroup
if CreateAdGroup($DN_of_OU, $addlprintgroup, "global", 1, "Additional Printer")
? "Group successfully created"
else
? "CreateAdGroup Failed with Error: " + @error
endif


endif

next

$rc=redirectoutput('')

endif



[ 14. October 2003, 22:38: Message edited by: tjcarst ]