Script Printer Driver Installation and Network Printer Connection
- From: "ebferro" <ebferro@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 16 May 2005 07:15:14 -0700
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"
.
- Follow-Ups:
- Prev by Date: Re: Can you call LoadLibrary/GetProcAddress using VBScript?
- Next by Date: Is the RegExp object thread-safe?
- Previous by thread: ADODB.Stream straight after creating file
- Next by thread: Re: Script Printer Driver Installation and Network Printer Connection
- Index(es):
Relevant Pages
|