大概写了个,没完善- 'sssssssssssssssssssss
- WScript.Timeout = 90
- DayInterval = 3600
- WQLInterval = 3
- TargetProcessName = "calc.exe"
-
-
- Dim objwmi,Events,NewEvent
- TargetWQL="Select * From __InstanceOperationEvent Within " & WQLInterval & " Where TargetInstance ISA " &_
- "'Win32_Process' AND TargetInstance.Name='" & TargetProcessName & "'"
- Set objwmi=GetObject("winmgmts:\\.\root\cimv2")
- Set Events=objwmi.ExecNotificationQuery(TargetWQL)
-
-
- count = 0
- stime = now
- ProcessChk = 0
- StartDates = Date
-
-
- Do
-
- Set NewEvent=Events.NextEvent
-
- Select Case NewEvent.Path_.Class
- Case "__InstanceCreationEvent"
- If (ProcessChk = 0) Then
- If (count = 0) Then stime=now
- count = count+1
- Else
- NewEvent.TargetInstance.Terminate
- End If
- Case "__InstanceDeletionEvent"
- count=count-1
- If (count <= 0) Then DayInterval=DayInterval-DateDiff("s",stime,now)
- Case Else 'Case "__InstanceModificationEvent"
- If DateDiff("s",stime,now) >= DayInterval Then
- If (count = 0) Then count = count+1
- NewEvent.TargetInstance.Terminate
- ProcessChk = 1
- End If
- End Select
-
- If (Date-StartDates) Then
- count = 0
- stime = now
- ProcessChk = 0
- StartDates = Date
- End If
-
- loop
复制代码
|