You are not logged in. Login Now
 0-1          
 
Author Message
nharmon
Printers drivers, oh my Mark Unseen   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_

1 responses total.
nharmon
response 1 of 1: Mark Unseen   Sep 7 17:15 UTC 2006

Nevermind, figured it out:

-----------------
set objDriver = objWMIService.Get("Win32_PrinterDriver")
objDriver.Name = "KONICA MINOLTA 350/250/200 PCL"
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
objDriver.FilePath = "c:\\drivers\\printers\\"
objDriver.Infname = "c:\\drivers\\printers\\CLJ2600.inf"
intResult = objDriver.AddPrinterDriver(objDriver)
 0-1          
Response Not Possible: You are Not Logged In
 

- Backtalk version 1.3.30 - Copyright 1996-2006, Jan Wolter and Steve Weiss