WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Printing Information

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Determining Printer IP Address

Keywords: 	  Printer IP Address

Question:

Do you know of a way w/in WinBatch to get the IP address of a network printer w/ a jetdirect card (or similar) that hard-codes the IP addr?

It's visible as Port: in the Ports tab of printer properties on an NTW box that has connected to the printer.

Answer:

There is a data value named "Port" (see REG file below) in the registry for each printer that is defined in WinNT. You could count the # of periods in the name of the port and if the count is 2 or more periods with a colon character following the periods then you can assume that have either an IP address (a.b.c.d:rprinter-name) or a domain name (someprinter.somecompany.com:rprinter-name).

The print processor should also be "winprint".

Once you have determined that this is an LPR printer and have isolated the printer's domain name you can resolve it to an IP address. If the IP address was hard coded then your task is already done.

Example #1: LPR Printer (LPR1.REG):

REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\HP DeskJet 540]
"ChangeID"=dword:0003c0a3
"Status"=dword:00000180
"Name"="HP DeskJet 540"
"Share Name"=""
"Print Processor"="winprint"
"Datatype"="RAW"
"Parameters"=""
"Description"=""
"Printer Driver"="HP DeskJet 540"
"Default DevMode"=hex:48,00,50,00,20,00,44,00,65,00,73,00,6b,00,4a,00,65,00,74,\
  00,20,00,35,00,34,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,04,01,03,dc,\
  00,70,00,03,6a,01,00,01,00,01,00,00,00,00,00,00,00,01,00,0f,00,2c,01,02,00,\
  01,00,2c,01,02,00,00,00,4c,00,65,00,74,00,74,00,65,00,72,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,20,00,ff,ff,ff,ff,1f,03,00,00,00,00,00,00,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,\
  12,00,06,00,12,00,06,00,03,00,ff,ff,03,00,00,00,ff,ff,01,00,00,00,00,00,01,\
  00,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,\
  ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,00,00,00,00,18,00,00,00,00,00,10,27,10,27,10,\
  27,00,00,10,27,00,00,00,00,00,00,00,00
"Priority"=dword:00000001
"Default Priority"=dword:00000000
"StartTime"=dword:00000000
"UntilTime"=dword:00000000
"Separator File"=""
"Location"=""
"Attributes"=dword:00000000
"txTimeout"=dword:0000afc8
"dnsTimeout"=dword:00003a98
"Security"=hex:01,00,04,80,e4,00,00,00,f4,00,00,00,00,00,00,00,14,00,00,00,02,\
  00,d0,00,08,00,00,00,00,0a,14,00,00,00,02,00,01,01,00,00,00,00,00,03,00,00,\
  00,00,00,09,14,00,00,00,00,10,01,01,00,00,00,00,00,03,00,00,00,00,00,00,14,\
  00,08,00,02,00,01,01,00,00,00,00,00,01,00,00,00,00,00,0a,14,00,00,00,00,20,\
  01,01,00,00,00,00,00,01,00,00,00,00,00,00,18,00,0c,00,0f,00,01,02,00,00,00,\
  00,00,05,20,00,00,00,20,02,00,00,00,0b,18,00,00,00,00,10,01,02,00,00,00,00,\
  00,05,20,00,00,00,20,02,00,00,00,00,18,00,0c,00,0f,00,01,02,00,00,00,00,00,\
  05,20,00,00,00,23,02,00,00,00,0b,18,00,00,00,00,10,01,02,00,00,00,00,00,05,\
  20,00,00,00,23,02,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,00,01,05,\
  00,00,00,00,00,05,15,00,00,00,e3,6a,7b,72,65,4b,97,5b,2d,2f,ce,10,01,02,00,\
  00
"SpoolDirectory"=""
"TotalJobs"=dword:0000005d
"TotalBytes"=hex:93,a4,e2,00,00,00,00,00
"TotalPages"=dword:00000063
"Port"="HPDJ540AS.RTFMCSI.COM:RAW"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\HP DeskJet 540\PrinterDriverData]
"Country"=dword:00000001
"Model"="HP DeskJet 540"
"TrayFormTable"=hex(7):41,75,74,6f,00,4c,65,74,74,65,72,00,30,00,45,6e,76,65,\
  6c,6f,70,65,20,46,65,65,64,65,72,00,30,00,30,00,00
"FreeMem"=hex:ff,ff,ff,ff
"RasddFlags"=hex:00,00
"FontCart"=hex(7):30,00,00


Example #2: LPR Printer (LPR2.REG):

REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\TERMSL8F]
"ChangeID"=dword:0003c0a3
"Status"=dword:00000180
"Name"="TERMSL8F"
"Share Name"=""
"Print Processor"="winprint"
"Datatype"="RAW"
"Parameters"=""
"Description"=""
"Printer Driver"="Lexmark Optra N PS"
"Default DevMode"=hex:54,00,45,00,52,00,4d,00,53,00,4c,00,38,00,46,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,04,00,04,dc,\
  00,b4,00,13,d7,01,00,01,00,01,00,00,00,00,00,64,00,01,00,0f,00,58,02,01,00,\
  01,00,00,00,03,00,00,00,4c,00,65,00,74,00,74,00,65,00,72,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,50,52,49,56,e0,10,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,18,00,00,00,00,00,10,27,10,27,10,\
  27,00,00,10,27,00,00,00,00,00,00,00,00,96,7f,0d,00,00,00,ff,00,00,00,00,00,\
  00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00
"Priority"=dword:00000001
"Default Priority"=dword:00000000
"StartTime"=dword:00000000
"UntilTime"=dword:00000000
"Separator File"=""
"Location"=""
"Attributes"=dword:00000000
"txTimeout"=dword:0000afc8
"dnsTimeout"=dword:00003a98
"Security"=hex:01,00,04,80,e4,00,00,00,f4,00,00,00,00,00,00,00,14,00,00,00,02,\
  00,d0,00,08,00,00,00,00,0a,14,00,00,00,02,00,01,01,00,00,00,00,00,03,00,00,\
  00,00,00,09,14,00,00,00,00,10,01,01,00,00,00,00,00,03,00,00,00,00,00,00,14,\
  00,08,00,02,00,01,01,00,00,00,00,00,01,00,00,00,00,00,0a,14,00,00,00,00,20,\
  01,01,00,00,00,00,00,01,00,00,00,00,00,00,18,00,0c,00,0f,00,01,02,00,00,00,\
  00,00,05,20,00,00,00,20,02,00,00,00,0b,18,00,00,00,00,10,01,02,00,00,00,00,\
  00,05,20,00,00,00,20,02,00,00,00,00,18,00,0c,00,0f,00,01,02,00,00,00,00,00,\
  05,20,00,00,00,23,02,00,00,00,0b,18,00,00,00,00,10,01,02,00,00,00,00,00,05,\
  20,00,00,00,23,02,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,00,01,05,\
  00,00,00,00,00,05,15,00,00,00,e3,6a,7b,72,65,4b,97,5b,2d,2f,ce,10,01,02,00,\
  00
"SpoolDirectory"=""
"TotalJobs"=dword:00000000
"TotalBytes"=hex:00,00,00,00,00,00,00,00
"TotalPages"=dword:00000000
"Port"="10.23.23.197:RAW"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\TERMSL8F\PrinterDriverData]
"FreeMem"=dword:00000378
"PrinterHT"=hex:00,00,00,00
"PrinterDataSize"=dword:00000068
"PrinterData"=hex:00,04,68,00,00,00,00,00,b0,e2,0d,00,00,00,00,00,f0,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,96,7f,08,00,01,01,01,01,01,\
  01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00


Resolution:

Thanks for the info. Unfortunately it only pertains to NT w/ IP printing installed. But I found the same info in: HKLM\...\print\monitors\LPR port\ports\ so I could read it from there.
Article ID:   W14284
Filename:   Determining Printer IP Address.txt
File Created: 1999:10:26:11:23:02
Last Updated: 1999:10:26:11:23:02