The following KB will be walking through a script modified by James Kirsop with additional praise and credits to Walter Meyer, Nick McSpadden, and Michael Page.
A common pain point for many is the ability to remotely deploy and configure printers that leverage the AirPrint protocol, which these days seems to be a majority. Given that these are driverless, the deployment can be more confusing. Thankfully, through the hard work of the wonderful people mentioned above, we have this script that is capable of configuring and deploying AirPrint printers.
https://github.com/jameskirsop/macOSPrinterDeployment/blob/main/scripts/installation
Personalizing the script
There are only a few variables within the script that we must modify, which are all at the top of the script. Please do not edit any contents of the script below the "### Nothing below this line needs to change. ###" comment.
1: "protocol"
This protocol varies from printer to printer, but generally speaking, if you are looking to deploy a printer that uses the AirPrint protocol we would recommend using "ipp" to start. Note: If the printer install does not work the first time around, this is a variable you will want to review and adjust as needed.
2: "address"
This variable is fairly straightforward in that it is simply the address of the printer. As the comment mentions, you can use a variety of addresses, but for AirPrint, IP is usually the best/easiest to gather. If you are not sure how to gather this information, you could use an app like "Discovery". Do note that the printer must be connected to the device in order for Discovery to read the network information.
3: "use_ipp_everywhere"
We generally want to keep this value set to "true" unless otherwise needed.
4: "driver_ppd"
If you are configuring a printer that uses AirPrint, comment out this line by adding a "#" to the beginning, like so:
# driver_ppd="/Library/Printers/PPDs/Contents/Resources/HP Color LaserJet Pro M252.gz"
If your printer does use drivers, you will have to gather the path from a device with the printer actively installed. This command is what you will want to use (make sure to change yourPrinterMakeModel):
lpinfo --make-and-model "yourPrinterMakeModel" -m
To get the make and model of your printer, you can use this command and search for the "MakeModel" entry for your printer:
cat /etc/cups/printers.conf
Generating a Condition Script/Removal Script
The use of a Condition Script is highly recommended to avoid Smart Software unintentionally reinstalling the printer and possibly causing disruptions. Within the same link, there is a "conditions" section: https://github.com/jameskirsop/macOSPrinterDeployment/blob/main/scripts/conditions
Prior to leveraging the Condition Script, ensure that the printer install works in testing so that the script accurately checks for the correct printer. The same can be said for the removal script as well, which can be found here: https://github.com/jameskirsop/macOSPrinterDeployment/blob/main/scripts/remove
Creating the Smart Software Item
- In Addigy, navigate to Catalog > Software > Smart Software > New
- In the Smart Software creation window, title the "Software name" something obvious and match the version of the Smart Software to the version defined in the script (this is not a requirement, but is recommended)
- In the "Installation Command" dialog box, paste your install script, like so:
- If you have a Condition Script, select "Condition for Install" under "Options" and select "Advanced: Custom Conditional Commands". Therein you will paste your script:
- If you have a removal script, simply paste the script in the "Removal Command" dialog box.
As always, please test, re-test, and test again to ensure everything is properly configured. If you require any further assistance on this, please do not hesitate to submit a support ticket.