Create and disable WMI monitoring in luacom. It's cool. Then open notepad.exe and close it to see the two rows of output.
Getting started with WMI
Package. cpath = [[c: \ Program Files \ Lua \ 5.1 \ clibs \?. DLL] require "luacom" strcomputer = "mycomputername" obw.miservice = luacom. GetObject ("winmgmts: {impersonationlevel = impersonate }! \\\\".. Strcomputer .. "\ Root \ cimv2") csink = luacom. createobject ("wbemscripting. swbemsink ") dsink = luacom. createobject ("wbemscripting. swbemsink ") csinkh = {} function csinkh: onobjectready (objobject, objasynccontext) print (" process create detected: ", objobject: targetinstance (): Name () endfunction csinkh: oncompleted (objobject, objasynccontext) print ("completed") enddsinkh ={} function dsinkh: equals (objobject, objasynccontext) print ("process Delete detected:", objobject: targetinstance (): name () endfunction dsinkh: oncompleted (objobject, objasynccontext) print ("completed") endobjwmiservice: execicationqueryqueryasync (dsink, "select * from _ instancedeletionevent within 1 where targetinstance ISA 'win32 _ process'") ob1_miservice: execicationicationqueryasync (csink, "select * from _ instancecreationevent within 1 where targetinstance ISA 'win32 _ process'") luacom. connect (csink, csinkh) luacom. connect (dsink, dsinkh) luacom. startmessageloop ()