The problemI'm trying to install a shared printer on windows 10 64 bit machine using Powershell. The printer originates from an Ubuntu's CUPS (Common Unix Printing Service) and reachable at
Right now this process is done manually with the Printers & scanners wizard and I’d like to automate it with Powershell.
Here is what the manual process looks like
- From the Printers & scanners wizard, I click on
Add a printer & scanner. Click for an image
- I then always click on
The printer that I want isn't listed, just to be able to enter the link and be sure it's the right printer. Click for an image
Add PrinterWizard appears and I choose
Select a shared printer by name, then click
Next. Click for an image
- Here, although the driver should have already been installed prior to this process, the popup to install the printer driver is really useful and would be great if that popup could come up using Powershell if the driver isn't installed.
- I get a success message, Next and done.
What I've triedI tried installing the printer with the following sequences of commands with the driver already installed:
- Add-Printer Only, results in an error message (ip, port and printername changed manually)
Click here to see output. I couldn't copy-paste it here because "it looks like spam"
PS C:\> Add-Printer -ConnectionName "http://ip:port/printers/printername"
- Add-PrinterPort then Add-Printer, commands pass and I see the printer, but spits and error when I try to print a test page ("Error printing on myprinter").
PS C:\> Add-PrinterPort -Name "myport" -PrinterHostAddress "xx.xx.xxx.xxx" -PortNumber xxx PS C:\> Add-Printer -Name "myprinter" -DriverName "Brother MFC-L2720DW series" -PortName "myport"
- I also tried using the both
PortNameParameters to the Add-Printer command but I get the error message:
Parameter set cannot be resolved using the specified named parameters.