Casper Custom Imaging - Scripting Option - Parameter 1

IHawk
New Contributor

Greetings,

I’m looking to simplify the imaging process even more for the techs in the field and need some help. After doing a great deal of reading/research on scripting I was able to create a script the will add a print by command line.

#!/bin/sh

read prtname

printername="$prtname"

/usr/sbin/lpadmin -p $printername -E -v lpd://$printername.xxx.xxxx.xx/E450 -P /Library/Printers/PPDs/Contents/Resources/Lexmark E450dn.gz -D $printername

What I’m hoping is that someone can explained how I can have my tech launch Casper Imaging -> Select Custom Install -> Scripts -> choose the “add printer” script and on the Script Option Parameter 1 , I would like to have the Tech enter in the printer’s host name in Parameter 1.

Our supported OSX version

10.5, 10.6 and 10.7

LJ

3 REPLIES 3

jarednichols
Honored Contributor

Parameter 1 when using Imaging, Remote or Policies is actually $4. ($1, $2 and $3 are reserved by Casper).

In following your script, why are you setting printername to prtname? It seems redundant.

Instead, kill the read prtname line. Set the next line to be printername=$4. You want it to be this:

#!/bin/sh

printername=$4

/usr/sbin/lpadmin -p $printername -E -v lpd://$printername.xxx.xxxx.xx/E450 -P /Library/Printers/PPDs/Contents/Resources/Lexmark E450dn.gz -D $printername

Then, in Casper Admin, in your script's Options tab, give a name to "Parameter 4." Something like "Printer Name." That way it'll be labeled properly in Casper Remote, Imaging and Policies.

IHawk
New Contributor

jarednichols -

Thank You very much.... that did it and it also open up many other possibilities.

mm2270
Legendary Contributor III

Yeah, script parameters you can pass from Casper Suite can make your scripts even more useful and versatile. Glad you're discovering good use for them.