We help IT Professionals succeed at work.
Get Started

check my code

Indarnav
Indarnav asked
on
267 Views
Last Modified: 2012-05-06
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

Open in new window

Comment
Watch Question
Engineer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE