Network printer installation via command line

Tazos27 Posted messages 72 Status Member -  
kaumune Posted messages 22605 Registration date   Status Contributor Last intervention   -
Hello,

I would like to know how to install a network printer with a static IP using the command line on Windows 10, so that I can later create a script.
I specify that I do not have a print server.

Thank you in advance for your responses.

Configuration: Windows / Chrome 54.0.2840.99

1 answer

  1. kaumune Posted messages 22605 Registration date   Status Contributor Last intervention   5 157
     
    Hi

    I used to use this line under XP (on a single line, no spaces between %windir%\inf\ntprint.inf /r) for my Epson printer

    rundll32 printui.dll,PrintUIEntry /if /b "Epson Network" /f %windir%\inf\ntprint.inf /r "IP_192.168.1.250" /m "Epson Stylus COLOR ESC/P 2"


    by typing rundll32 printui.dll,PrintUIEntry /? in a command prompt, you'll get the meaning of each parameter along with examples so you can adapt the command to your printer

    0
    1. Tazos27 Posted messages 72 Status Member 4
       
      Hello,

      thank you for your reply but I'm having trouble :(
      Is the INF file mandatory? I'm trying with the command: rundll32 printui.dll,PrintUIEntry /b "OKI CAMILLE" /r "192.168.1.62" but it tells me invalid argument, I tried instead with /in, it says: unable to complete this operation (error 0x000000709) Check that the printer name is correct and that the printer is connected to the network.
      0
    2. kaumune Posted messages 22605 Registration date   Status Contributor Last intervention   5 157
       
      It's old, I had forgotten some things, we first need to create the port via the BDR

      My reg (on IP address 192.168.1.250, port 515 and a print queue named PS-72B566-P3)

      Actually, I had installed the printer manually and exported the entry in the registry (then of course deleted the port)
      which gives me the following reg:

      Windows Registry Editor Version 5.00

      [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.250]
      "Protocol"=dword:00000002
      "Version"=dword:00000001
      "HostName"=""
      "IPAddress"="192.168.1.250"
      "HWAddress"=""
      "PortNumber"=dword:00000203
      "SNMP Community"="public"
      "SNMP Enabled"=dword:00000000
      "SNMP Index"=dword:00000001
      "Queue"="PS-72B566-P3"
      "Double Spool"=dword:00000000


      Then we stop and restart the spooler

      Net stop spooler
      net start spooler

      and finally we run the command line

      Ps: yes, the inf is mandatory as well as the /m which gives the name of the driver to use

      Tested on XP and W10 pro
      1