Option Explicit
On Error Resume Next
dim strcomputer
dim objwmiservice
dim colmonitoredprocesses
dim datstartdate
dim objlatestprocess
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService. _
ExecNotificationQuery("select * from __instancecreationevent " _
& " within 1 where TargetInstance isa 'Win32_Process'")
datStartdate = Now()
'msgbox "start of monitor"
Do While cint(DateDiff("s",datStartdate,Now())) < 300
Set objLatestProcess = colMonitoredProcesses.NextEvent
Wscript.Sleep 6000 'here we go again, yawn, yawn
If objLatestProcess.TargetInstance.Name = "IEXPLORE.EXE" Then
WScript.Sleep 6000 ' yes i know i should be shot
objLatestProcess.TargetInstance.Terminate
Exit Do
End If
Loop
'msgbox "out of loop"
Set objLatestProcess = Nothing
Set colMonitoredProcesses = Nothing
Set objWMIService = Nothing
Wscript.Quit