If you have multiple printers, you likely have a print server running. If not, I’d recommend spinning up a small Linux VM (Preferrably Debian) and set it as your printing portal, so to speak.

IPP (Internet Printing Protocol) is the defacto standard for sending print jobs over a modern network. Yes, LPR and RAW still work (and maybe even use it under the hood), but industry is moving.

This guide will explain and show how to use Powershell on your Windows computer(s) to connect to a CUPS-based printer over IPP.

TL;DR

# Add the printer driver to the Driver Store
pnputil.exe -a path/to/driver.inf

# Add the printer driver to the local print spooler
Add-PrinterDriver -Name "Driver Name as it appears in driver.inf"

# Add the connection using the IPP URL
Add-Printer -Name "LocalQueueNameHere" `
    -PortName "http://10.1.2.3:631/printers/CUPSQueueNameHere" `
    -DriverName "Driver Name as it appears in driver.inf"

# If you want to bypass a CUPS server, and if IPP is enabled on the printer
Add-Printer -Name "LocalQueueNameHere" `
    -PortName "ipp://10.2.3.4:631/ipp/print/" `
    -DriverName "Driver Name as it appears in driver.inf"

Deep dive

Adding the print driver to the Driver Store

Windows holds its drivers for all devices in the Driver Store. This will be the first place it will look when a new device requests installation; if it isn’t found, it asks the user where the driver is. Obviously, not good for automation.

Printer Driver in the Spooler

Each computer that prints has a “Spooler” system to maintain everything printer-related. Drivers, ports, paper sizes, queues, and even the print jobs. Now that we understand why techies hate printers (Why do you need to install the driver twice??), you can look to see what drivers are installed, either in Print Management, Print Server Settings -> Drivers, or with Powershell:

Get-PrinterDriver

If you don’t see the print driver listed that you need, then Windows will not complete the Add-Printer command. You’ll need one driver for each model of printer you want to add; there are some printers that have multiple printer languages for multiple drivers (i.e. Konica Minolta has a PCL, PS, XPS and Fax driver for many models). Although your use case will vary, I prefer PS for Adobe-rich activities or long pages of documents; I prefer PCL for light office or picture printing. The Fax driver is special as it lets the user fax from their computer without printing the physical pages first.

Add the print queue

Print Queues are what operating systems use to connect a driver to a port to a particular setup. You can have multiple queues for various reasons, with the most common being:

  • A black and white vs colour defaults print queue
  • A “Secure Print” queue vs regular printing queue

These queues can point to the same server or the same printer. In my particular organization, we have a B&W queue and a Colour queue for each colour printer. In CUPS, they are listed as two different queues so it is painfully obvious to the user.

Each printer manufacturer can also use a different URL schema for IPP. If you can’t access the printer’s information to verify which path to use, you’ll need to use Google to check what they use. For example:

  • Lexmark printers use ipp://IPADDRESS/ipp/print
  • Konica Minolta use ipp://IPADDRESS/ipp/
  • CUPS print queues use http://IPADDRESS/printers/CUPSQueueName

If you are using TLS/SSL, use ipps:// (port 443) instead of unencrypted IPP (port 631). Try each URL until you hit the one you want. Printers can have different queue names as well (after the /ipp/ or /printers/ path), and that is why you need to know which path to use. In the case of CUPS, when you have dozens of print queues/connections, you can pick and choose which to use while keeping the same format for all the connections.

Once the queue is made with the correct path and driver, you can print to it.

Happy Printing!