Adding LPR port (non TCP/IP) via powershell

Chris Petrini 0 Reputation points
2023-01-31T22:34:07.97+00:00

Hi there I am having an issue with adding an LPR port to my machine via powershell. I need to create the following port correctly pictured below.

User's image

This results in the correct port looking like this.

User's image

Running the following script

Add-PrinterPort -Name "lprint.sa.ucsb.edu:SIST-01" -LprHostAddress "lprint.sa.uscb.edu" -LprQueueName "SIST-01"

Gives me a TCP/IP port. How on earth do I get around this?

I tried this:

Add-PrinterPort -ComputerName lprint.sa.ucsb.edu -PrinterName SIST-01 -hostname $env:COMPUTERNAME

but that resulted in some obscure error found below.

User's image

Any help would be much appreciated. The LPR service IS turned on.

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,617 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,124 questions
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
640 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,363 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,052 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. JIAN WANG 335 Reputation points
    2023-01-31T23:41:05.79+00:00

    try this

    Add-PrinterPort -ComputerName lprint.sa.ucsb.edu -PrinterName SIST-01 -hostname $env:COMPUTERNAME -AsJob
    

  2. Limitless Technology 43,931 Reputation points
    2023-02-02T10:08:16.88+00:00

    Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query.

    You can add an LPR (Line Printer Remote) port using the following PowerShell commands:

    1. Open a PowerShell window as an administrator.
    2. Use the following command to create an LPR port:

    Add-PrinterPort -Name "LPR Port Name" -PrinterHostAddress "LPR Server IP Address" -PortNumber "LPR Port Number" -Protocol "LPR"

    Replace "LPR Port Name" with the desired name for the port, "LPR Server IP Address" with the IP address of the LPR server, and "LPR Port Number" with the desired port number.

    1. Verify that the LPR port was created successfully by using the following command:

    Get-PrinterPort | Select-Object Name, Protocol, PortNumber, PrinterHostAddress

    This will display a list of all the printer ports and their properties, including the LPR port that was created.

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.


  3. Limitless Technology 43,931 Reputation points
    2023-02-02T10:08:27.5533333+00:00

    Double post

    0 comments No comments

  4. Alan Morris 1,156 Reputation points
    2023-03-08T00:21:22.7033333+00:00

    The correct PowerShell command to add a Standard TCP/IP Port in LPR Mode is

    Add-PrinterPort [-Name] <string> [-LprHostAddress] <string> [-LprQueueName] <string> [-ComputerName <string>]
        [-SNMP <uint32>] [-SNMPCommunity <string>] [-LprByteCounting]
    
    

    The Add-PrinterPort command supports adding Standard TCP/IP Port, Local Ports, and WSD Ports. LPR Port is not supported.

    0 comments No comments