Skip to main content
Question

remove current printers and deploy new ones

  • May 29, 2015
  • 7 replies
  • 105 views

Forum|alt.badge.img+6

Hi All

how to remove current printers installed in macs, and deploy new ones into macs

thanks

7 replies

Forum|alt.badge.img+7
  • Contributor
  • May 29, 2015

To remove all printers:

#!/bin/sh

for printer in `lpstat -p | awk '{print $2}'`
do
echo Deleting $printer
lpadmin -x $printer
done

Forum|alt.badge.img+6
  • Author
  • Contributor
  • May 29, 2015

@jonnydford Hi Jonny
thanks for your script, i know this is perfect for removing all the current printer. but in this case, i need to deploy another policy to add the new printers after i delete them by using your script. so it's gonna be funny for some of the clients that fall into a circle of adding and deleting printers.

so what i prefer is put all the actions of removing the current and adding the new into single script. that would be perfect to me.

u have any idea?


Forum|alt.badge.img+17
  • Honored Contributor
  • May 29, 2015

@Dalmatian create a policy that runs the script 'before' and then adds the printers. You can set the policy to run once, or at reboot ongoing, etc


Forum|alt.badge.img+6
  • Author
  • Contributor
  • May 29, 2015

@CasperSally Hi Sally

could you explain the script "before"?

thanks


Forum|alt.badge.img+18
  • Honored Contributor
  • May 29, 2015

If you deployed the prior printers via the JSS, you can keep the prior ones in your deployment policy, but select "unmap" to remove the specific printers which you want to remove. In the same policy you can "map" the new printers.


Forum|alt.badge.img+17
  • Honored Contributor
  • May 29, 2015

add the script to casper admin. In the script properties, make sure it's set to priority before.

add the printers you want to add to casper admin

set up a new policy in JSS.

add the script, add the printers, set scope and when/how often you want it to run. We do this same workflow for all of our student laptops in carts, etc.


Forum|alt.badge.img+7
  • Contributor
  • May 29, 2015

It depends how you plan to deploy new printers, but we use a script to do it.

Assuming the driver is already on the Macs then at the end of the script you can add something like:

lpadmin -p NAME_OF_PRINTER -E -v lpd://ip.ad.dre.ss -P /Library/Printers/PPDs/Contents/Resources/driverpath.gz"