' Asynchronously monitor process start trace events.



strComputer = "."
Set SINK = WScript.CreateObject("WbemScripting.SWbemSink","SINK_")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
objWMIService.ExecNotificationQueryAsync SINK, _
"SELECT * FROM Win32_ProcessStartTrace"
WScript.Echo "Waiting for process to start ..."
Do
   WScript.Sleep 1000
Loop

Sub SINK_OnObjectReady(objLatestEvent, objAsyncContext)

Wscript.Echo VbCrLf & "Process Name: " & objLatestEvent.ProcessName
Wscript.Echo "Process ID: " & objLatestEvent.ProcessId
Wscript.Echo "Time: " & Now

End Sub
search for scripts

VbsEdit contains all these sample scripts!





Home   Scripts

Copyright © 2001-2020 adersοft