Installing printing using Kbox and VBScript
I have a script that I have been using to install a network printer from command line. The dell kace pushes it out to the workstation, but I have been unable to get it to execute the script. Can anyone show me a link to how to sucessfully run a vbscript from the dell kace? Here is the code:
Dim Computer, DriverName, DriverInf, IPAddress, PortName, PrinterName
Dim WMI, NewPort, NewDriver, NewPrinter
' Enter Details of Printer
' Computer on which to create the printer.
Computer = "."
' The printer driver's name.
DriverName = "Canon iR-ADV C7055/7065 UFR II"
' The full path and filename of the .inf file.
DriverInf = "\\Path\to\INF\CNLB0U.inf"
' The printer's IP address.
IPAddress = "ip.of.network.printer"
' The printer's Name.
PrinterName = "ADV C7065"
' End of Details entering
' The port name that will be created.
PortName = "IP_" & IPAddress
' Establish WMI connection to specified computer.
' Note that the loaddriver privilege is required to add the driver.
Set WMI = GetObject("winmgmts:{impersonationlevel=impersonate" _
& ",(loaddriver)}!//" & Computer & "/root/cimv2")
' Step A: Install the printer's driver.
Set NewDriver = WMI.Get("Win32_PrinterDriver")
NewDriver.Name = DriverName
NewDriver.InfName = DriverInf
Result = NewDriver.AddPrinterDriver(NewDriver)
If Result = 0 Then
WScript.Echo "Added printer driver: " & DriverName
Else
WScript.Echo "Error " & Result & " adding printer driver: " & DriverName
WScript.Quit
End If
' Step B: Create a TCP/IP printer port for the printer.
Set NewPort = WMI.Get("Win32_TCPIPPrinterPort").SpawnInstance_
NewPort.HostAddress = IPAddress
NewPort.Name = PortName
NewPort.Protocol = 1 ' 1 = Raw, 2 = LPR
NewPort.Put_
WScript.Echo "Created printer port: " & PortName
' Step C: Add the printer.
Set NewPrinter = WMI.Get("Win32_Printer").SpawnInstance_
NewPrinter.DriverName = DriverName
NewPrinter.DeviceID = PrinterName
NewPrinter.PortName = PortName
NewPrinter.Put_
WScript.Echo "Created printer: " & PrinterName
Answers (2)
http://www.itninja.com/question/kace-k1000-how-do-you-run-a-vbscript-file
Also with printers make sure you change to "logged in user" since by default it will run as SYSTEM.
take a look at this link for installing printer drivers with inf's