PART 1 ------ Here is a Script that I use to install printers on windows Xp machines - IF I run the script on the windows 7 Machine I get the error (scriptname.vbs(28, 1) SWbe mObjectEx:Generic failure), If i use this script and run it from the command line I get the same message. If i run the script a few times the printer will eventually install. for windows 7 Machines. What do I Need to change ????
Part 2 - Secondly I would like to have users run this script. How do i change the script to run as domain\user password with the credentials been seen?
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
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 = "Canon iR5070 PCL6"
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
objDriver.FilePath = "K:\\DRIVERS\\Canon Copier\\pcl6"
objDriver.Infname = "K:\\DRIVERS\\Canon Copier\\pcl6\\P62KUSAL.INF"
intResult = objDriver.AddPrinterDriver(objDriver)
'Installs Printer Port
objNewPort.Name = "10.16.11.185"
objNewPort.Protocol = 1
objNewPort.HostAddress = "10.16.11.185"
objNewPort.PortNumber = 9100
objNewPort.SNMPEnabled = True
objNewPort.Put_
'Install Printer
objPrinter.DriverName = "Canon iR5070 PCL6"
objPrinter.PortName = "10.16.11.185"
objPrinter.DeviceID = "Canon iR5070 PCL6"
objPrinter.Location = "E.Hart 99 East River Dr 6th Flr"
objPrinter.Network = True
objPrinter.Put_