nharmon
|
|
Printers drivers, oh my
|
Sep 7 16:37 UTC 2006 |
Ok, I am writing a vbscript to install network printers onto
workstations. The script seems to work fine, except it assumes that the
printer driver is already installed. So is there a way to install a
driver using vbscript, or perhaps is there another way of installing a
driver to a workstation like copying the files into a specific directory
or something?
Here is the script:
-----------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewPort = objWMIService.Get ("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = "IP_10.0.20.201"
objNewPort.Protocol = 1
objNewPort.HostAddress = "10.0.20.201"
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = True
objNewPort.Put_
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
objPrinter.DriverName = "HP LaserJet 4000 Series Ps"
objPrinter.PortName = "IP_10.0.20.201"
objPrinter.DeviceID = "ScriptedPrinter"
objPrinter.Location = "Ops/2floor"
objPrinter.Network = True
objPrinter.Shared = False
objPrinter.Put_
|