Adding a TCP/IP port to the registry via reg.exe (REG ADD)

M

Mike Kiser

Hi all. I am writing a batch file to automatically
install network printers in my area using reg.exe (REG
ADD) and then rundll32 printui.dll,PrintUIEntry from the
command line. What are the proper registry entries and
values to successfully add a printer port? I navigated
through
HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standa
rd TCP/IP Port\Ports and took a look at the entries and
values for each of my existing ports. They were all the
same (besides the names of the ports) and so I created a
batch file full of REG ADD entries to add these entries
and values for a new port. They all added succesfully
after checking out the registry, BUT...

....when I right-click a printer in Settings-->Printers and
choose Properties to look at the ports, my new port isn't
listed. Furthermore, trying to add the printer from the
command line (rundll32 printui.dll,PrintUIEntry /if etc.)
produces an error saying that the printer is not available
or isn't connected to the network (which I know isn't
true).

Here are the lines of the batch file. The name of the
printer (and thus what I am wanting to name the port) is
MCH1C3A. Any ideas about what is going wrong?

REG
ADD "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\S
tandard TCP/IP Port\Ports\MCH1c3A"

REG
ADD "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\S
tandard TCP/IP Port\Ports\MCH1C3A\HostName"=MCH1C3A

REG
ADD "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\S
tandard TCP/IP Port\Ports\MCH13CA\HWAddress"=

REG
ADD "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\S
tandard TCP/IP Port\Ports\MCH1C3A\IPAddress"=

REG
ADD "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\S
tandard TCP/IP Port\Ports\MCH1C3A\PortNumber"=9100
REG_DWORD

REG
ADD "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\S
tandard TCP/IP Port\Ports\MCH1C3\Protocol"=1 REG_DWORD

REG
ADD "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\S
tandard TCP/IP Port\Ports\MCH1C3A\SNMP Community"=public

REG
ADD "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\S
tandard TCP/IP Port\Ports\MCH1C3A\SNMP Enabled"=1
REG_DWORD

REG
ADD "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\S
tandard TCP/IP Port\Ports\MCH1C3A\SNMP Index"=1 REG_DWORD

REG
ADD "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\S
tandard TCP/IP Port\Ports\MCH1C3A\Version"=1 REG_DWORD

rundll32 printui.dll,PrintUIEntry /ia /m "HP LaserJet 2100
Series
PS" /h "Intel" /v "Windows2000" /f "c:\winnt\inf\ntprint.in
f"

rundll32
printui.dll,PrintUIEntry /if /b "MCH1C3A" /f "c:\winnt\inf\
ntprint.inf" /r "MCH1C3A" /m "HP LaserJet 2100 Series PS"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top