Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Addition of new printers - tcp/ip port printing

Featured Replies

I've done some searching on the forums, and have yet to find a good way to do the following at part of an unattended / WPI installer. Say I have a printer that has a JetDirect card on 10.10.10.14. Let's say it's an HP Laserjet 4000. Is there any way to script the installation of this printer so that you have the HPLJ 4000 printing to port TCP/IP 10.10.10.14, and not just a network map to it?

I've found the following information regarding it:

Make network port:

RunDLL32.EXE tcpmonui.dll,LocalAddPortUI  <- this will open the add new TCP/IP port wizard, but I don't know how to do this silently with scripted additions

Install Printer

RunDLL32.exe printui.dll,PrintUIEntry /ia /m "Hp LaserJet 4000 PCL 5e" /h "Intel" /v "Windows 2000 or XP" /f C:\printers\hp4000pcl5e\hp4000p5.inf  <- this will install the driver for the printer (if exists on LPT1) with the inf located in C:\printers.  The question would be how to redirect the port to be the one created earlier with the above command so that the printer prints to 10.10.10.14 instead of LPT1.

After looking at the rundll32 printui.dll,PrintUIEntry /? screen, I've seen to connect to a UNC printer but not to the TCP/IP port.

Any suggestions / help would be appreciated. I've got a couple hundred machines that all printer to different peer printers [so that traffic is not passed through the server] that I need to reload. Adding all these printers manually instead of using RIS/Unattended or WPI/equivalent would take AGES!

Thanks in Advance,

Diamond

Two VBScript examples derived from a script found on the web:

Source

--> Raw Port 9100, no SNMP

Set objWMIService = GetObject("winmgmts:")

Set objNewPort = objWMIService.Get _

("Win32_TCPIPPrinterPort").SpawnInstance_

objNewPort.Name = "IP_192.168.40.20"

objNewPort.Protocol = 1

objNewPort.HostAddress = "192.168.40.20"

objNewPort.PortNumber = "9100"

objNewPort.SNMPEnabled = False

objNewPort.Put_

--> LPR Port, SNMP

Set objWMIService2 = GetObject("winmgmts:")

Set objNewPort2 = objWMIService2.Get _

("Win32_TCPIPPrinterPort").SpawnInstance_

objNewPort2.Name = "IP_192.168.40.21"

objNewPort2.Protocol = 2

objNewPort2.HostAddress = "192.168.40.21"

objNewPort2.Queue = "MyQueue"

objNewPort2.ByteCount = True

objNewPort2.SNMPEnabled = True

objNewPort2.SNMPDevIndex = 2

objNewPort2.SNMPCommunity = "MySNMP"

objNewPort2.Put_

Save as <filename>.vbs and start using cscript.exe or wscript.exe

This will create the ports for you.

Then use How to add printers with no user interaction in Windows with an example on how to connect to a local IP port.

Example:

rundll32 printui.dll,PrintUIEntry /if /b "NORTH-US-SRTEST-TEST24-BOGUS" /f %windir%\inf\ntprint.inf /r "IP_192.168.40.20" /m "HP Laserjet 4000 Series PCL" /Z

:blushing:

Edited by schalti

  • Author

Just wanted to follow up, Schalti's information is good and works like a champ! I've written some VBS files for a lot of our network printers and have tested it and works with a single click. Thanks Schalti!

Just a 'final look', I'm sure this could all be done in vbs, but I've always been more comfortable with batch scripting, so for a static printer, here's an example. This is for an LPR printer, Toshiba 4511 Copier/Printer/Fax to be exact:

toshiba.vbs:

Set objWMIService2 = GetObject("winmgmts:")
Set objNewPort2 = objWMIService2.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort2.Name = "IP_10.10.10.222"
objNewPort2.Protocol = 2
objNewPort2.HostAddress = "10.10.10.222"
objNewPort2.Queue = "PRINTER"
objNewPort2.ByteCount = True
objNewPort2.Put_

Then to run it unattended from Runonce, Guirunonce, WPI, etc, the installer.cmd file:

@REM This will install the TCP/IP port then install the printer and fax machine for the Toshiba Printer.
@cscript I:\printers\TOSH3511\tosh.vbs
@rundll32 printui.dll,PrintUIEntry /if /b "Toshiba 3511 Printer" /f "I:\printerdrivers\Toshiba 3511print\eS4c5c2k.inf" /r "IP_10.10.10.222" /m "TOSHIBA e-STUDIO4511SeriesPCL5c"
@rundll32 printui.dll,PrintUIEntry /if /b "Toshiba 3511 Fax" /f "I:\printerdrivers\Toshiba 3511fax\eS4cfx2K.inf" /r "IP_10.10.10.222" /m "TOSHIBA e-STUDIO Series Fax"

Please note that this is from a netinstall, so the drive letters are maps to a shared installation directory. You'd have to change it to local for a CD based install or otherwise.

Thanks again for all the help, hope this information helps someone else one day!

Diamond

Three things:

- it works only on XP as of now

- it fails on 2000 because the needed WMI Class is not implemented

- it fails on 2003 because there is some bug or restriction somewhere - currently under investigation -> there are even examples online @M$ that do not work!

Using both VBScripts and Shell scripts is fine, some things you can only implement with VBScript, some need considerable less code to implement in a Shell script.

:thumbup

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.