question

GabeCz-5083 avatar image
0 Votes"
GabeCz-5083 asked RichMatheisen-8856 answered

How to add LPR port manually?

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-server-powershellwindows-server-print
image.png (30.0 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered GabeCz-5083 commented

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


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks.
That adds a port on the print server and only works if you run it on a domain joined computer.
I need to add a LPR port on the non-domain joined computer not on the server.

0 Votes 0 ·
RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered

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".

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.