Intro
I was curious the other day on what the command is in terminal to install a printer on a Mac since some of my customers don't give admin rights to their end users to change printer settings.
Here is an example of installing a Dell 1765nfw printer to a Mac running Yosemite.
Prerequisite
- Grab the driver from the manufacturer. You will need the .ppd.gz file format of the driver.
- Example: Dell C1765nfw Color MFP.ppd.gz
- I pulled this driver from /Library/Printers/PPDs/Contents/Resources/ on a Mac that already had the printer installed
Instructions
- Create a new Online Kscript
- For Operating System, uncheck Select Specific Operating System and select Mac OSX.
- Under Dependencies, upload your printer driver ppd.gz file
- Add a New Task
- First step is copying the driver to the Printer PPD directory.
- Under On Success - Launch Program:
- Directory: /bin/
- File: cp
- Parmeters: /Library/Application\ Support/Dell/KACE/data/kbots_cache/packages/kbots/130/Dell\ C1765nfw\ Color\ MFP.ppd.gz /Library/Printers/PPDs/Contents/Resources/
- *Change the number 130 to the ID of your script that gets made. (hover your mouse over the name of the script from the script list)
- Add another step underneath this one
- Directory: /usr/sbin
- File: lpadmin
- Parameters: -p Dell_C1765nfw_Color_MFP -L "Bruce's Office" -E -v lpd://10.0.0.3 -P "/Library/Printers/PPDs/Contents/Resources/Dell C1765nfw Color MFP.ppd.gz" -u allow:all
- Change the IP address to the IP of the printer.
- -L is the location (Bruce's Office) which you can change in the command
- -u allow:all allows all users to see and change the printer settings
Test and run the script to ensure it installs. It should pop right up in the Printers list even if you have it opened.
Removing a printer
This is an example of removing a specific printer.
- Create a new Online Kscript
- For Operating System, uncheck Select Specific Operating System and select Mac OSX.
- Add a New Task
- Under On Success - Launch Program:
- Directory: /usr/sbin/
- File: lpadmin
- Parameters: -x Dell_C1765nfw_Color_MFP
- If you need to get the name of the printer, you can just grab it from the Inventory of that Mac and replace it in the command above (minus the :idle part. That's the current status of the printer)
I used this to copy multiple driver files and install a total of 3 printers in one script for an art lab. The question I have is there a command line I can run to set a certain printer as default
I am thinking I can run this command at the end of the script to set the printer I want as default.
/usr/sbin/lpadmin -d printer - bwilkerson 9 years ago
Yep, that's the switch for setting it as a default. That could be part of the command you use when you install that particular printer. - brucegoose03 9 years ago