Link to home
Start Free TrialLog in
Avatar of youngrmy
youngrmyFlag for United States of America

asked on

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_
ASKER CERTIFIED SOLUTION
Avatar of judgeking
judgeking
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
youngrmy, any update?
youngrmy, any update?
youngrmy, any update?
youngrmy, any update?
Avatar of Martin Liss
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Avatar of youngrmy

ASKER

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?