Home > Casper, Mac administration, Mac OS X, Scripting > Deploying Canon print drivers with printer setups via Casper’s Self Service

Deploying Canon print drivers with printer setups via Casper’s Self Service

In my shop, we use a number of Canon ImageRunner printers and have them set up in Casper’s Self Service so that our users can set them up themselves. All of the Canon printers in question have PostScript enabled, so I’ve been deploying the Canon PostScript drivers.

Historically, one of the things that was installed along with the drivers was a proprietary printing application that sat between the Mac’s CUPS printing system and the actual printer. That changed with the release of Canon’s 4.x PostScript drivers. With the new drivers, Canon has switched to using LPR and no longer uses that proprietary printing application.

Good news: Canon is no longer building in a custom printer program to handle talking to the printer; instead the new drivers are using LPR.

Bad news: Our existing printer setups that are available in Self Service do not work with the new printer drivers. I would need to delete and re-add our various printers to Self Service.

The bad news wasn’t a big problem by itself, but my testing showed that updating the printers in Self Service to accommodate the new printer drivers would make them no longer backwards-compatible with the old drivers. The new drivers would need to be installed in order for the new printers to work. Conversely, just pushing out the new drivers to our Macs could result in existing printer setups breaking.

In short, here were the problems I was looking at:

1. The old printer setups could not use the new drivers

2. The new printer setups could not use the old drivers

3. The new drivers needed to be installed before the new printer setup happened.

4. I didn’t want to break existing printer setups if I could avoid it.

Making the new drivers available in Self Service as standalone installers wasn’t an issue but I was concerned about adding them to the printer setups themselves. That potentially could result in the printer drivers being installed over and over again as people set up multiple printers on one Mac. I also wanted to avoid problems with accidentally trying to overwrite newer drivers, in the event that Canon released new drivers and someone installed them before I updated the driver installer in Self Service.

For details on how I addressed this, see below the jump.

Here’s the workflow I wanted to use when a Canon printer setup is requested via Self Service:

A. Casper will check the Mac to see if the needed Canon printers are installed.

B. If no Canon drivers or older Canon drivers are detected, the appropriate Canon print drivers will be installed before the requested printer is set up.

C. If the installed drivers are the same version or higher as the print drivers available via Self Service, no drivers are installed and Casper will proceed to set up the printer using the installed drivers.

The first part was figuring out if the needed Canon drivers were installed. Canon’s installer package didn’t have an easy way I could see to discern the driver version from the installer receipts, so I looked for something else that would have the version number. After some digging, I was able to confirm that the Canon CUPS PS Printer Utility application located in /Library/Printers/Canon/CUPSPS2/Utilities had the version number that I was looking for.

Screen Shot 2014-02-05 at 5.07.21 PM

I also confirmed that I could use the defaults command to pull the version information from the CFBundleVersion key value stored in /Library/Printers/Canon/CUPSPS2/Utilities/Canon CUPS PS Printer Utility.app/Contents/Info.plist.

Using this information, I built the following script:


#!/bin/bash
# Check /Library/Printers/Canon/CUPSPS2/Utilities/Canon CUPS PS Printer Utility.app/Contents/Info.plist
# for the CFBundleVersion key value. It should match the version of the installed drivers.
installed_driver=$(defaults read "/Library/Printers/Canon/CUPSPS2/Utilities/Canon CUPS PS Printer Utility.app/Contents/Info" CFBundleVersion)
# Specify the current driver version
# by setting parameter 4 in the script
# on the JSS
driver_version="$4"
if [[ ${installed_driver} > ${driver_version} ]]; then
echo "Canon PS $installed_driver Print Drivers installed"
fi
if [[ ${installed_driver} == ${driver_version} ]]; then
echo "Canon PS $driver_version Print Drivers installed"
fi
if [[ ${installed_driver} < ${driver_version} ]]; then
echo "Canon PS $driver_version Print Drivers not installed. Installing Canon PS $driver_version Print Drivers"
jamf displayMessage -message "The needed Canon printer drivers have not been detected. Installing Canon PS $driver_version Print Drivers before adding the requested printer."
jamf policy -trigger companycanondrivers
fi

view raw

gistfile1.sh

hosted with ❤ by GitHub

The script checks /Library/Printers/Canon/CUPSPS2/Utilities/Canon CUPS PS Printer Utility.app/Contents/Info.plist for the CFBundleVersion key value. Based on the key value, the following actions are taken:

– If the value returned is less than the version of the current drivers, the print drivers are installed by a Casper policy before the requested printer is set up.

– If the installed drivers are the same version or higher as the print drivers available on the Casper server, this information is logged and the Canon print drivers are not installed.

The driver version that the script is looking for is then set on the JSS by using Parameter 4 in the JSS settings for the script. As of 2-6-2014, the current version is 4.1.0.

Screen Shot 2014-02-05 at 3.54.32 PM

The script uses a manual trigger to run a Casper policy that would install the print drivers. The next part was to build a policy which used that trigger.

Building the policy was straightforward, as I just needed it to respond to the manual trigger and install the package specified by the policy. When new Canon drivers come out, all I should need to do is update the policy with the new installer package.

Screen Shot 2014-02-05 at 4.03.15 PM

Screen Shot 2014-02-05 at 4.03.21 PM

Once I had the script and policy in place, I updated my printer setup policy with the new printer settings and added the previously-mentioned script. When added, I set the script to Run Before and set 4.1.0 in the Parameter 4 blank.

Screen Shot 2014-02-05 at 3.54.32 PM

Screen Shot 2014-02-05 at 3.55.00 PM

The other policy options were set as shown below:

Screen Shot 2014-02-06 at 12.44.48 PM

Screen Shot 2014-02-05 at 3.57.43 PM
Screen Shot 2014-02-06 at 12.44.25 PM

The result is how it appears at the user’s end. When the printer setup is selected, the script will run before the printer setup and do its version check.

Screen Shot 2014-02-06 at 1.02.35 PM

Screen Shot 2014-02-06 at 1.03.29 PM

If new drivers are needed, a message will appear to inform the user that the drivers are being installed.

Screen Shot 2014-02-06 at 1.03.19 PM

Once the printer setup has completed, a message will then appear to let the user know that the printer setup has completed.

Screen Shot 2014-02-06 at 1.04.32 PM

One issue that this process does not address is the problem of existing printer setups. In the documentation for the new drivers, Canon noted that existing printers may need to be deleted and re-setup following the installation of the new drivers. Since the new drivers are now automatically installed on an as-needed basis by Self Service, existing printers may break.

That said, if all relevant Canon printers are registered in Self Service, the fix should be to tell folks with this problem to delete the non-working printer and set up the printer again in Self Service.

Screen Shot 2014-02-05 at 2.32.27 PM

  1. February 10, 2014 at 4:56 pm

    Thank you for sharing this – I’m actually hoping to do something similar with our set up here. Would prefer to have driver versions checked this way as opposed to installing the drivers over and over again for the reasons you stated. We’ve got mostly HP and Xeroxes here.

    • February 10, 2014 at 9:48 pm

      Lauren,

      Since you use Xerox printers, you may also want to look at this post:

      Deploying Xerox print drivers on a per-OS basis via Casper’s Self Service

      • February 11, 2014 at 3:17 am

        Rich, thanks – that’s great! I’m looking forward to playing around with this and have already set up a reminder for myself to check it out tomorrow. Our printer driver policy setup have been nagging me for months – what we have is better than the methodology it replaced but it’s far from being as efficient or effective as I’d like. The treatment of the drivers that are already installed on the client was something that I was hoping to address with something like this.

  2. Jimmy Jell
    September 12, 2018 at 6:55 am

    thanks for sharing this article. I purchased a canon printer 15 days ago. I install canon driver in my mac. but canon install’s package had not installed. I search on the internet I read about canon printer support and they fix this problem.

  1. No trackbacks yet.

Leave a comment