Share via

How to add LPR port manually?

GabeCz 26 Reputation points
2021-10-21T23:00:42.687+00:00

Hi
I'm trying to find a way to add a LPR printer port via PowerShell. The add-printerport creates standard TCP/IP port only.
Basically what this Ok button does in the background I'd like to know. Figured so far, that it creates a bunch of registry entries, which if I create via reg add, it won't show up in printmanagement.msc/ports.

142642-image.png

Thank you!

My goal is to have a script that adds a printer (say HP_MFP_Counter) on a domain joined print server (10.0.0.100) to a non-domain joined computer on the same network.

The registry entries are these, but something else is running additionally I can't figure out. This is all I found using Sysinternals Process Monitor.

Reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\LPR Port\Ports\10.0.0.100:HP_Counter_MFP" /v "Printer Name" /t REG_SZ /d "HP_Counter_MFP" /f
Reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\LPR Port\Ports\10.0.0.100:HP_Counter_MFP" /v "Server Name" /t REG_SZ /d "10.0.0.100" /f
Reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\LPR Port\Ports\10.0.0.100:HP_Counter_MFP" /v "EnableBannerPage" /t REG_DWORD /d 0 /f
Reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\LPR Port\Ports\10.0.0.100:HP_Counter_MFP" /v "HpUxCompatibility" /t REG_DWORD /d 0 /f
Reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\LPR Port\Ports\10.0.0.100:HP_Counter_MFP" /v "OldSunCompatibility" /t REG_DWORD /d 0 /f

Windows for business | Windows Server | User experience | Print jobs
Windows for business | Windows Server | User experience | PowerShell

2 answers

Sort by: Most helpful
  1. Rich Matheisen 48,116 Reputation points
    2021-10-22T19:20:57.41+00:00

    It's not PowerShell, but check the C:\Windows\System32\Printing_Admin_Scripts\en-US directory for the 7 vbs scripts supplied by MS. WMI is used, so they're transferable to PowerShell, but there's a ton of definitions and options.

    The printer config script is "prncnfg.vbs".

    Was this answer helpful?

    0 comments No comments

  2. Rich Matheisen 48,116 Reputation points
    2021-10-22T01:27:10.663+00:00

    Does this work (I haven't tried it)? quick-tip-create-new-lpr-printers-using-powershell

    Was this answer helpful?


Your answer

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