We help IT Professionals succeed at work.

VBScript Error Win 7 (scriptname.vbs(28, 1) SWbe mObjectEx:Generic failure)

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_
Comment
Watch Question

Windows 7 has 32-bit versions of wscript.exe, cscript.exe, regsvr32.exe, etc in the C:\Windows\SysWOW64.  Try running the script explicitly using C:\Windows\SysWOW64\wscript.exe
youngrmy, any update?
youngrmy, any update?
youngrmy, any update?
youngrmy, any update?
Martin LissSocial distance - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Author

Commented:
Please close with the following, I was assigned other projects that took me away from this one. I had resolved the issue by 1st coping down a copy of the PSExec Utility and then a copy of the script file down to the PC's,  That enabled me to run the following batch file and run the script withour Error. "psexec -accepteula -i -u Domain\username -p password cmd /c "c:\canon\test.vbs" -accepteula"

I had to create a separate script file for each printer/location
youngrmy, did you try or even read my solution?

Explore More ContentExplore courses, solutions, and other research materials related to this topic.