Script Printer Driver Installation and Network Printer Connection

Tech-Archive recommends: Speed Up your PC by fixing your registry



I am attempting to use the script below to automatically add a printer driver
for a Phaser 780 and then install a network printer connection to that
printer. The script seems to execute fine, no errors are returned when I run
it. When it's done and I look in the printers folder, the printer is added.
However, when I do a properties on that printer and attempt to print to it,
nothing happens. Can someone tell me what I'm missing here. Also, my thanks
to the many people who have posted scipts on this newsgroup as most of this
scripts comes from bits and pieces I've picked up here and in the script
repository.
TIA
Ernie

PrinterName = "Phaser 780"
OSPlatform = "Windows NT x86"
PrinterDriverVersion = "5.02"
DriverPath = "i:\Phaser 780\pscript5.dll"
InfFileName = "i:\Phaser 780\win2kms.inf"

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True

Set objDriver = objWMIService.Get("Win32_PrinterDriver")

objDriver.Name = PrinterName
objDriver.SupportedPlatform = OSPlatform
objDriver.Version = PrinterDriverVersion
objDriverPath = DriverPath
objInfname = InfFileName

intResult = objDriver.AddPrinterDriver(objDriver)

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &_
"\root\cimv2")
Set objNewPort = objWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_

objNewPort.Name = "Phaser780"
objNewPort.Protocol = 1
objNewPort.HostAddress = "192.168.10.60"
objNewPort.PortNumber = "9300"
objNewPort.SNMPEnabled = False
objNewPort.Put_

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &_
"\root\cimv2")

Set WshNetwork = CreateObject("WScript.Network")

WshNetwork.AddWindowsPrinterConnection "\\vscrcfs601\Phaser780"
.



Relevant Pages

  • Re: Cannot print in OE6 both news and mail
    ... > Recently I found out that I cannot print out any mails or news from ... > Do you want to continue running the script on this page? ... > printer driver and paper port sw for scanner. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Problem with printing and open a new window
    ... You may need to update your printer driver. ... printer and download and install the most recent driver for that printer for ... Check the box next to "Disable Script Debugging " ... I have a problem with open a new window from hyperlink or shortcuts. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Adding IP Ports and Printers to a Print Server
    ... I have a script that I've gotten from various sources that allows me to ... required and cannot be empty. ... 'The following code specifies the printer driver to use. ...
    (microsoft.public.scripting.vbscript)
  • Script to install printers
    ... I need some assistance with the following script. ... map and install printer driver. ... strLine = mid ... strDriver = mid ...
    (microsoft.public.scripting.vbscript)
  • Re: Unable to print from IE6
    ... Do you want to continue running the script on this page? ... > Paul wrote: ... >>> You may need to update your printer driver. ... >>> Close the browser. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)