Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I add a TCP/IP Printer via a batch file 1

Status
Not open for further replies.
Mar 22, 2002
29
0
0
US
I am trying to find some information on how to write a script or batch file to install a local TCP/IP port printer without having to use the add printer wizard.

TIA

Rich
 
I happened to be looking for something like that too and found MS KB article number #189105, which might help. One of the examples shown is as follows:

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

This can go into a batch file.

Good luck,

Jon
 
whippingboy... this is the script I just wrote, I was after the same thing, it should give you an idea of how it needs to be written. Just change the driver path, Printer name, Port name, and Ip address of the port and it works great!!
*** NOTE: You need to have the Windows 2000 Resource Kit loaded for this functionality. As you can see the path points to the Resource kit directory. Hope this helps!!
Once you do get the resource kit, drop to a cmd prompt and change directory to the Resource kit dir, and type " cscript portmgr.vbs /? and for the other utility type " rundll32 printui.dll,PrintUIEntry /? " and it will bring up your list of variables, and what they are used for.
**********************************************************
@echo off
c:
cd cd Program Files\Resource Pro Kit
regsvr32 /s prnadmin.dll

echo.
echo Please wait while your printer is being installed
echo.
echo This should only take a moment
echo.
echo.

timeout 1 >null

cscript portmgr.vbs -a -p "IP_10.136.2.xxx" -t raw -n 9100 -h 10.136.2.xx -me -y public

timeout 2 >null

rundll32 printui.dll,PrintUIEntry /if /b "Printername" /f "G:\IT\Drivers\Printers\HP\Hp LaserJet 4000TN\hp222ip6.inf" /r "IP_10.136.2.xxx" /m "HP LaserJet 4000 Series PCL 6" /z
REM The printer port naming convention
REM is "IP_xxx.xxx.xxx.xxx"

timeout 3 >null
echo.
echo.
echo.
echo.
echo ** Printer Has Been Installed **
echo.
echo Written by:
timeout 3 >null ***********************************************************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top