Help with IP Printer add thorugh script

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

gareth

Distinguished
Feb 8, 2001
79
0
18,630
Archived from groups: microsoft.public.windowsnt.print (More info?)

Good one spamming the newsgroup....

Cos if you post the questions 3 times people will answer more quickly :p


"Steve Phillips" <StevePhillips@discussions.microsoft.com> wrote in message
news:1FB4D8A9-4626-49DF-84B1-36624CA39489@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."
 
G

Guest

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

I love people that show their ignorance. Maybe you should have questioned it
before running your mouth.

Microsoft kept reporting failure to post message & said to try again. I
tried three times and gave up, came back later and all three were posted.

Thanks for playing.

"Gareth" wrote:

> Good one spamming the newsgroup....
>
> Cos if you post the questions 3 times people will answer more quickly :p
>
>
> "Steve Phillips" <StevePhillips@discussions.microsoft.com> wrote in message
> news:1FB4D8A9-4626-49DF-84B1-36624CA39489@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."
>
>
>
 
G

Guest

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

Just posted again & here is what I receive:

An error occurred while sending your post
--------------------------------------------------------------------------------

We're sorry, but there was a problem with the system and your post was not
received. The error has been reported to Operations and will be investigated
as soon as possible. Please try again later.



"Gareth" wrote:

> Good one spamming the newsgroup....
>
> Cos if you post the questions 3 times people will answer more quickly :p
>
>
> "Steve Phillips" <StevePhillips@discussions.microsoft.com> wrote in message
> news:1FB4D8A9-4626-49DF-84B1-36624CA39489@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."
>
>
>
 
G

Guest

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

Can this script fun on Windows NT?

"Steve Phillips" <StevePhillips@discussions.microsoft.com> wrote in message
news:65E8B6AC-5DC5-48C9-8512-09ABB306A4C4@microsoft.com...
> Just posted again & here is what I receive:
>
> An error occurred while sending your post
> --------------------------------------------------------------------------
------
>
> We're sorry, but there was a problem with the system and your post was not
> received. The error has been reported to Operations and will be
investigated
> as soon as possible. Please try again later.
>
>
>
> "Gareth" wrote:
>
> > Good one spamming the newsgroup....
> >
> > Cos if you post the questions 3 times people will answer more quickly
:p
> >
> >
> > "Steve Phillips" <StevePhillips@discussions.microsoft.com> wrote in
message
> > news:1FB4D8A9-4626-49DF-84B1-36624CA39489@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."
> >
> >
> >
 
G

Guest

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

"Steve Phillips1" wrote:
> Just posted again & here is what I receive:
>
> An error occurred while sending your post
> --------------------------------------------------------------
> ------------------
>
> We're sorry, but there was a problem with the system and your
> post was not
> received. The error has been reported to Operations and will
> be investigated
> as soon as possible. Please try again later.
>
>
>
> "Gareth" wrote:
>
> > Good one spamming the newsgroup....
> >
> > Cos if you post the questions 3 times people will answer
> more quickly :p
> >
> >
> > "Steve Phillips" <StevePhillips@discussions.microsoft.com> wrote in message
> > news:1FB4D8A9-4626-49DF-84B1-36624CA39489@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
> \s1avdc01ToolsPrnadmin.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 will have to change the IP information"

’"also where prnadmin is located"

Set WshShell = Wscript.CreateObject("Wscript.Shell")

WshShell.Run "regsvr32 /s
\\fl-msitest-orl\nde\Prnadmin.dll",1,TRUE

’************** Create the port first *****************************

’Port types
const kTcpRaw = 1, kTcpLPr = 2, kLocal = 3, kLocalDownLevel = 4,
kLprMon = 5, kHPdlc = 7

dim oPort
dim oMaster
set oPort = CreateObject("Port.Port.1")
set oMaster = CreateObject("PrintMaster.PrintMaster.1")

oPort.PortName = "IP_10.1.1.21"
oPort.PortType = kTcpRaw
oPort.HostAddress = "10.1.1.21"
oPort.PortNumber = "9100"
oMaster.PortAdd oPort

if Err <> 0 then
msgbox "There was an error creating the port."
end if

--
http://www.WindowsForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.WindowsForumz.com/Print-Help-IP-er-add-thorugh-script-ftopict215798.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.WindowsForumz.com/eform.php?p=667747