G
Guest
Guest
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")
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."
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."