Tom's Hardware > Forum > Windows 2000/NT > Windows 2000/NT General Discussion > Need help adding tcp/ip printer through script

Need help adding tcp/ip printer through script

Forum Windows 2000/NT : Windows 2000/NT General Discussion - Need help adding tcp/ip printer through script

Tom's Hardware: Over 1.4 million members in 6 different countries available to answer all your high-tech questions. Sign up now! Its free!
Word :    Username :           
 

Archived from groups: microsoft.public.windowsnt.print (More info?)

 

I want to be able to reimage a PC, then use a script to add an TCP/IP
Printer. Here is what I have but it adds the ip address as a local port
instead of a TCP/IP Port. I've already tried change the "oPort.PortType" to
different numbers but no luck, any help would be greatly appreciated. Also
note I'm an extremely new to scripts. Thanks again.


'******** 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."

Sponsored Links
Register or log in to remove.
Tom's Hardware > Forum > Windows 2000/NT > Windows 2000/NT General Discussion > Need help adding tcp/ip printer through script
Go to:

There are 1176 identified and unidentified users. To see the list of identified users, Click here.

Please mind

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.

Add a reply Cancel
Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them