Hallelujah! Hallelujah! Halleluuuuuuuujah!
Sorry, I'm not even a religious person, but this warranted something.
The original script worked. Very slick, very cool. Thanks for the effort, it truly is appreciated. (Even though I could have manually created these groups three times over, I am thrilled to get this to work!!)
Now I have another project I'll be pestering you with related to these groups.
Thanks everyone!
Script used:
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:\printers5.txt
$printers = GetObject("LDAP://OU=Printers,DC=madonna,DC=local")
$DN_of_OU ="OU=Printer Groups,DC=madonna,DC=local"
if @error
? @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 " + $defprintgroup + " successfully created"
else
? "CreateAdGroup " + $defprintgroup + " Failed with Error: " + @error
endif
$addlprintgroup = "A_MRH-01_"+$printername
if CreateAdGroup($DN_of_OU, $addlprintgroup, "global", 1, "Additional Printer")
? "Group " + $addlprintgroup + " successfully created"
else
? "CreateAdGroup " + $addlprintgroup + " Failed with Error: " + @error
endif
endif
next
$rc=redirectoutput('')
endif
tjcarst
[edited to clean up code spacing a little]
[ 23. October 2003, 17:15: Message edited by: tjcarst ]