Search code examples
cmdwindows-7-x64rundll32

How Do I Set The "Print directly to the printer" attribute on an IPP Printer in Windows 7 x64 with PrintUIEntry?


Summary

I'm trying to automate a script for Windows 7 x64 to set the "Print directly to the printer" attribute on an IPP Printer I've created (see screenshot below)

enter image description here

I've tried rundll32 printui.dll,PrintUIEntry /Xs /n "PrinterName" attributes +direct as suggested here, but I get the error The arguments are invalid


Solution

  • After beating my head against this for 2 weeks, I came across the solution:

    PrintUIEntry has an "undocumented switch": /x. This must be present for the initial printer installation.

    An undocumented /x switch is required to map an IPP printer. (Content ID 314486)

    source


    Ultimately, that's all that needed to be added.

    rundll32 printui.dll PrintUIEntry /if /f %windir%\\inf\\ntprint.inf /r “http://localhost:<port>/” /m “<drivername>” /b ”<PrinterName>” /n “<PrinterName>” /q /Y /z /u /x
    
    rundll32 printui.dll,PrintUIEntry /Xs /n "<PrinterName>" attributes +direct`