Re: prnAdmin.dll on windows 2003

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Tarjei T. Jensen (tarjei_at_online.no)
Date: 02/02/05


Date: 2 Feb 2005 09:13:14 +0100

Tarjei T. Jensen wrote:
> Any suggestions of what I have done wrong?
>

1. You stayed at work too long, so you did not read the documentation
carefully enough. prnAdmin.dll cannot create LprMon ports (that is worrying
since several types of multifunction machines seems to need it in order to
perform decently).

You may want to manipulate the registry in order to create LprMon ports
automatically. And then stop and start the spooler to get it to notice the
ports.

LprMon ports live in
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\LPR
Port\Ports.

2. You read the port type as text, so there was a numeric comparison to text
and that did not work very well.

Revised working function.

function create_port(port_name, port_type)
dim aPort

   aPort = split(port_name, ":")

   port_type = port_type + 0 ' Force to numeric

   create_port = true

   oPort.ServerName = ""
   oPort.PortName = port_name

   if ( KLprMon = port_type ) or ( KTcpLpr = port_type ) then
      wscript.echo "Here"
      oPort.PortType = KTcpLpr
      oPort.HostAddress = aPort(0)
      oPort.QueueName = aPort(1)
      oPort.DoubleSpool = true
   else
      oPort.PortType = port_type
   end if

   oPort.SNMP = false

   oMaster.PortAdd oPort
   if 0 <> Err or Err <> &H80070034 then
      wscript.echo port_name & " " & port_type & " " & err
      create_port = false
   end if

end function