youngrmy
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:{imper sonationLe vel=impers onate}!\\" & strComputer & "\root\cimv2")
set objNewPort = objWMIService.get("Win32_T CPIPPrinte rPort").Sp awnInstanc e_
Set objPrinter = objWMIService.Get("Win32_P rinter").S pawnInstan ce_
objWMIService.Security_.Pr ivileges.A ddAsString "SeLoadDriverPrivilege", True
Set objDriver = objWMIService.Get("Win32_P rinterDriv er")
objDriver.Name = "Canon iR5070 PCL6"
objDriver.SupportedPlatfor m = "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_
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:{imper
set objNewPort = objWMIService.get("Win32_T
Set objPrinter = objWMIService.Get("Win32_P
objWMIService.Security_.Pr
Set objDriver = objWMIService.Get("Win32_P
objDriver.Name = "Canon iR5070 PCL6"
objDriver.SupportedPlatfor
objDriver.Version = "3"
objDriver.FilePath = "K:\\DRIVERS\\Canon Copier\\pcl6"
objDriver.Infname = "K:\\DRIVERS\\Canon Copier\\pcl6\\P62KUSAL.INF
intResult = objDriver.AddPrinterDriver
'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
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
youngrmy, any update?
youngrmy, any update?
youngrmy, any update?
youngrmy, any update?
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
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
I had to create a separate script file for each printer/location
youngrmy, did you try or even read my solution?