This successfully creates the D_mrh-01_q-therapy print group in AD.
And I can see when I run the other part of the script without the CreateADGroup function, that the group names are returned correctly to screen or file as specified.
code:
call @ScriptDir+'\CreateAdGroup.udf'
;********** Beginning of group creation *********
$logfile=c:\printers.xls
$printers = GetObject("LDAP://OU=Printers,DC=madonna,DC=local")
$DN_of_OU ="OU=Printer Groups,DC=madonna,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
if CreateAdGroup($DN_of_OU, "D_mrh-01_q-therapy", "global", 1, "Additional Printer")
? "Group successfully created"
else
? "CreateAdGroup Failed with Error: " + @error
endif
endif
next
$rc=redirectoutput('')
endif
[ 18. October 2003, 20:04: Message edited by: tjcarst ]