Adding Internet Port by command line

Paul Rattu 1 Reputation point
2021-08-05T16:04:12.473+00:00

Hi, I'm trying to figure out how to add a printer using the add-printerport and add-printer commands.

I can add my print server printers manually using the GUI, but I'm not able to do this by command line.

If I run this command I can add a printer but with the wrong port type:

add-printerport -name "Canon2" -printerhostaddress "http://locationofmyprintserver/"

add-printer -name "Canon2" -drivername "Canon iR-ADV C3325/3330 PCL6" -port "Canon2"

When I add the print server by GUI I get the correct port type:

120829-image.png

What parameter do I need to set in add-printerport to get it to add the port as Internet Port instead of Standard TCP/IP Port?

Thanks!

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,818 questions
{count} votes

3 answers

Sort by: Most helpful
  1. S.Sengupta 15,766 Reputation points MVP
    2021-08-06T08:14:24.673+00:00

    Kindly go through the following Microsoft article:

    Add-PrinterPort

    0 comments No comments

  2. Paul Rattu 1 Reputation point
    2021-08-06T16:06:07.487+00:00

    I've gone through that doc, there's nothing in there about adding Internet Ports.

    0 comments No comments

  3. Castorix31 82,116 Reputation points
    2021-08-06T19:57:31.247+00:00

    I did a test with rundll32 printui.dll,PrintUIEntry (How to add printers with no user interaction in Windows)
    with an Internet Port and it was added correctly

    I tested with an address got from Google and my Epson printer to check it :

    rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /r "https://print.concordia.ab.ca/printers/CUCA_PRINT/.printer" /m "EPSON XP-510 Series"  
    
    0 comments No comments