Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Installing printer using vbs and getting error

Status
Not open for further replies.

jack1529

Technical User
Jun 19, 2008
7
US
I'm trying to run the following script and keep gettin this error...Microsoft VBScript runtime error: Object required: '[string: "..."]'It happens on line three. Please help!


Dim objnetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
Set strComputer= objNetwork.ComputerName
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & objNetwork.ComputerName )

set objNewPort = objWMIService.get("Win32_TCPIPPrinterPort").SpawnInstance_
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True
Set objDriver = objWMIService.Get("Win32_PrinterDriver")

objDriver.Name = "HP LaserJet P3005 PCL 6"
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
objDriver.FilePath = "V:\SETUP\Printers\HP LaserJet P3005 PCL 6"
objDriver.Infname = "V:\SETUP\Printers\HP LaserJet P3005 PCL 6\hpzipa13.inf"
intResult = objDriver.AddPrinterDriver(objDriver)

'Installs Printer Port
objNewPort.Name = "..."
objNewPort.Protocol = 1
objNewPort.HostAddress = "..."
objNewPort.PortNumber = 9999
objNewPort.SNMPEnabled = True
objNewPort.Put_

'Install Printer
objPrinter.DriverName = "HP LaserJet P3005 PCL 6"
objPrinter.PortName = "..."
objPrinter.DeviceID = "..."
objPrinter.Location = ""
objPrinter.Network = True
objPrinter.Put_
 
The line three don't need the set keyword.

strComputer= objNetwork.ComputerName

 
thank you. The script now runs with no errors but the printer does not install
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top