troubleshooting Question

check my code

Avatar of Indarnav
Indarnav asked on
VB Script
9 Comments1 Solution268 ViewsLast Modified:
i wrote one code, but getting error while running. error is : "SWbemObjectEx: Not found" at line 157.
set ows = createobject ("wscript.shell")
x= 0
do while i =0
sname = "explorer"
sname1 = "jusched"
sname5 = "acrotray"
sname6=  "alg"
sname7 = "svchost"
sname8 = "system idle process"
sname9 = "system"
sname13 = "smss"
sname14 = "csrss"
sname15 = "winlogon"
sname16 = "services"
sname17 = "lsass"
sname18 = "cfsmsmd"
sname19 = "cnfagent"
sname20 = "spoolsv"
sname21 = "cam"
sname22 = "mdm"
sname23 = "NTRtscan"
sname24 = "Ofant"
sname25 = "Tmlisten" 'left
sname26 = "sched"
sname27 = "PccNTUpd"
sname28 = "cfnotsrvd"
sname29 = "ccsmagtd"
sname30 = "cfFTPlungin"
sname31 = "taskmgr"
sname32 = "wininit"
sname33 = "audiodg"
sname34 = "wmiprvse"
sname35 = "lsm"
sname36 = "ccsvchst"
 
 
 
sComputer = "."
 
 
set oWMIService = GetObject("winmgmts:"_
& "{impersonationlevel =impersonate}!\\" & scomputer & "\root\cimv2")
 
Set colprocesses = owmiservice.execquery _
("select name from win32_Process")
 
for each oprocess in colprocesses
sprocess = oprocess.name
 
if instr(Ucase(sprocess), Ucase(sName)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName1)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName5)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName6)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName7)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName8)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName9)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName13)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName14)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName15)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName16)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName17)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName18)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName19)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName20)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName21)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName22)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName23)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName24)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName25)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName26)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName27)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName28)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName29)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName30)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName31)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName32)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName33)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName34)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName35)) then
x = x +1
elseif instr(Ucase(sprocess), Ucase(sName36)) then
x = x +1
 
 
x = 0
else 
oprocess.terminate
end If
 
next
wscript.sleep 12000
Loop
ASKER CERTIFIED SOLUTION
Aard Vark
Principal Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros