Add a local IPP printer queue programmatically or with Powershell when Windows protected print mode is enabled

Jan 25 Reputation points
2024-11-01T16:27:40.0233333+00:00

After enabling Windows protected print mode I am no longer able to add a printer queue programmatically using the Win32 API nor using Powershell. Windows protected print mode requires me to use the built-in driver called Microsoft IPP Class Driver. The following Powershell command works when Windows protected print mode is disabled, but the question is, how can I install a printer queue with Windows protected print mode enabled (using the Win32 API or Powershell)?

Add-Printer -Name "My Printer Name"
            -PortName "http://printer-hostname:631/ipp/print"
            -DriverName "Microsoft IPP Class Driver"
Windows Server Printing
Windows Server Printing
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Printing: Printer centralized deployment and management, scan and fax resources management, and document services
694 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,706 questions
{count} vote

Accepted answer
  1. Göth Radim 85 Reputation points
    2024-11-06T14:30:05.9233333+00:00

    This works:

    Add-Printer -IppURL http://printer-hostname:631/ipp/print
    

    Anyone find out how to do it via win32 API?

    2 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Alan Morris 1,326 Reputation points
    2024-11-03T16:38:08.4466667+00:00

    Have you tried using printui.exe for this? Printui /? Will give you additional parameters. The printer must be turned on and Mopria compliant in order to be added when WPP is enabled. If that endpoint is not hardware, then you can't use printui or PowerShell


  2. Karlie Weng 18,761 Reputation points Microsoft Vendor
    2024-11-05T00:54:54.26+00:00

    Hello,

    You can find this in document: https://learn.microsoft.com/en-us/windows-hardware/drivers/print/windows-protected-print-mode#windows-protected-print-mode-device-compatibility

    upon enabling Windows protected print mode, printers that use third–party drivers are uninstalled.

    The print driver is deleted from the print driver store, and it can't be used while Windows protected print mode is active.


    If the Answer is helpful, please click "Accept Answer" and upvote it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.