Archived from groups: microsoft.public.windowsnt.print (More info?)
Want to re-image a pc then add a TCP/IP printer. Below is what I have so far
but keeps adding the IP address as a local port instead of TCP/IP port.
Already tried changing the "oPort.PortType" to other numbers but didn't seem
to work. Any help would be extremely grateful as I'm very very new to
scripts. Thanks so much.
'******** Register prnadmin.dll file on client computer *******
Set WshShell = Wscript.CreateObject("Wscript.Shell" )
'************** Create the printer second ***************************
'Change MyPrinter to the name of the printer that you are adding.
'Change PrinterDriver to the name of the printer driver that you are adding.
dim oPrinter
set oPrinter = CreateObject("Printer.Printer.1" )
oPrinter.PrinterName = "Test" ' name of the printer as it appears in the
Printers folder
oPrinter.DriverName = "HP LaserJet 2100" ' name that is referenced in
ntprint.inf
oPrinter.PortName = "IP_192.168.114.20" ' Specify a port name. Can also
point to LPT or COM port.
Archived from groups: microsoft.public.windowsnt.print (More info?)
Adding a TCP/IP SPM port requires more parameters. Did you try the
portmgr.vbs script? It comes with the reskit and has examples of how to add
SPM ports.
--
Felix Maxa
Windows Printing Team
This posting is provided "AS IS" with no warranties, and confers no rights.
"Steve Phillips" <Steve Phillips@discussions.microsoft.com> wrote in message
news:B0375EF5-4ECD-4F9C-8A83-578C9F3BCE32@microsoft.com...
> Want to re-image a pc then add a TCP/IP printer. Below is what I have so
> far
> but keeps adding the IP address as a local port instead of TCP/IP port.
> Already tried changing the "oPort.PortType" to other numbers but didn't
> seem
> to work. Any help would be extremely grateful as I'm very very new to
> scripts. Thanks so much.
>
>
> '******** Register prnadmin.dll file on client computer *******
>
> Set WshShell = Wscript.CreateObject("Wscript.Shell" )
>
> WshShell.Run "regsvr32 /s \\s1avdc01\Tools\Prnadmin.dll",1,TRUE
>
> '************** Create the port first *******************************
>
> dim oPort
>
> dim oMaster
>
> set oPort = CreateObject("Port.Port.1" )
>
> set oMaster = CreateObject("PrintMaster.PrintMaster.1" )
>
> oPort.PortName = "IP_192.168.114.20"
>
> oPort.PortType = 1
>
> oMaster.PortAdd oPort
>
> if Err <> 0 then
>
> msgbox "There was an error creating the port."
>
> end if
>
> '********************************************************************
>
> '************** Create the printer second ***************************
> 'Change MyPrinter to the name of the printer that you are adding.
> 'Change PrinterDriver to the name of the printer driver that you are
> adding.
>
>
> dim oPrinter
>
> set oPrinter = CreateObject("Printer.Printer.1" )
>
> oPrinter.PrinterName = "Test" ' name of the printer as it appears in the
> Printers folder
>
> oPrinter.DriverName = "HP LaserJet 2100" ' name that is referenced in
> ntprint.inf
>
> oPrinter.PortName = "IP_192.168.114.20" ' Specify a port name. Can also
> point to LPT or COM port.
>
> oMaster.PrinterAdd oPrinter
> If Err <> 0 then
>
> msgbox "There was an error creating the printer."
>
> end if
>
> '********************************************************************
>
> msgbox "The script is finished."
You are about to answer a thread that has been inactive for more than 6 months. If you still wish to proceed, please ensure that your posting is original and does not duplicate or overlap any prior responses to this thread.