Extension Attribute for Printer Driver version

llitz123
Contributor III

We're having issues with a Canon printer driver and it seems a newer version seems to be fixing these issues.
I'd like to create an Extension Attribute to show the same Driver Version shown under Options & Supplies > General tab for the printer in Printer & Scanners in System Preferences.
Then I can setup a Policy to track the printer driver versions.
Thanks for any assistance.

1 ACCEPTED SOLUTION

stevewood
Honored Contributor II
Honored Contributor II

What @bentoms suggested is probably the way to go, but I wanted to find a way to pull driver version without having to grab all of the printers like @clrlmiller had suggested.

Instead, use the ppd directory that CUPS uses: /etc/cups/ppd You can then look for exactly the PPD you need.

#!/bin/sh

# EA to pull printer driver version

# globals

ppdDir='/etc/cups/ppd'
printerName="YourPrinter"

# grab the driver version

driverVer=`cat $ppdDir/$printerName.ppd | grep FileVersion: | awk '{ print $2 }' | sed -e 's/"//' | sed -e 's/"//'`

echo "<result>$driverVer</result>"

I threw this together very quickly and tested on my machine with some of our Xerox printers, and it worked fine. Just make sure the name you put in for printerName variable is spelled correctly, including proper case.

View solution in original post

5 REPLIES 5

clrlmiller
New Contributor III

You could pull the info via the following in an Extension Attribute populated by a script. This will output a LOT of info and I don't know which portion you're looking to concentrate on, but modify to suit your needs and trim out the cruft. Hope this helps! We've recycled this little script for just about everything, Java, Flash, Shockwave, etc. :)

Extention Attribute setup below:
Data Type: String
Inventory Display: Extension Attributes
Input Type: Script

Script contents below:

#!/bin/sh
#
############################################################################
# Extension Attribute checks to display Canon Driver Version number.
############################################################################
CanonDriverVersion=/usr/bin/defaults read /Library/Printers/Canon/CUPSPS2/Info/PrinterInfo.plugin/Contents/Info.plist`
echo "<result> $CanonDriverVersion </result>"

exit 0

bentoms
Release Candidate Programs Tester

You could scope a smart group using the criteria: packages installed by Casper. (Or words to that affect). In this case I'd scope it to the new driver with "Does Not Have."

The smart group could then install the newer driver, then run a recon & the recon will then remove the mac from the group.

stevewood
Honored Contributor II
Honored Contributor II

What @bentoms suggested is probably the way to go, but I wanted to find a way to pull driver version without having to grab all of the printers like @clrlmiller had suggested.

Instead, use the ppd directory that CUPS uses: /etc/cups/ppd You can then look for exactly the PPD you need.

#!/bin/sh

# EA to pull printer driver version

# globals

ppdDir='/etc/cups/ppd'
printerName="YourPrinter"

# grab the driver version

driverVer=`cat $ppdDir/$printerName.ppd | grep FileVersion: | awk '{ print $2 }' | sed -e 's/"//' | sed -e 's/"//'`

echo "<result>$driverVer</result>"

I threw this together very quickly and tested on my machine with some of our Xerox printers, and it worked fine. Just make sure the name you put in for printerName variable is spelled correctly, including proper case.

ctangora
Contributor III

in the past I used the creation time for the ps2ps or similar file inside the drive to determine the OS it was built for.

rmanly
Contributor III

Steve! Buddy!

UUOC UUOGA

http://webcache.googleusercontent.com/search?q=cache:PKoRE6bBg-YJ:partmaps.org/era/unix/award.html+&...

;) :D

awk '/FileVersion/{ gsub(/"/,""); print $2 }' /etc/cups/ppd/file.ppd

Also, you can't assume the $printerName == $printerName.ppd. If there is a space in the name then the system will put underscores in the ppd filename. I don't know what happens with apostrophes or other weird things...

Cheers,
~Ryan