WolfWorld Posted May 22, 2007 Share Posted May 22, 2007 I want the path of the file too $filename= $objLatestEvent.TargetInstance.Properties_.item("Name").value This is only the file name any help my to get the path ;WMI monitoring #include<array.au3> #include<date.au3> Dim $arrComputers, $strQuery, $SINK, $objContext, $objWMIService, $objAsyncContextItem, $return, $account $arrComputers = _ArrayCreate(".") $strQuery = "SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_Process'" $SINK = ObjCreate("WbemScripting.SWbemSink") ObjEvent($SINK, "SINK_") For $strComputer In $arrComputers $objContext = ObjCreate("WbemScripting.SWbemNamedValueSet") $objContext.Add ("hostname", $strComputer) $objContext.Add ("SinkName", "sinktest") $objWMIService = ObjGet("winmgmts:!\\" & $strComputer) If Not @error Then $objWMIService.ExecNotificationQueryAsync ($SINK, $strQuery, Default, Default, Default, $objContext) ConsoleWrite("Waiting for processes to start on " & $strComputer & " ..." & @CRLF) EndIf Next ConsoleWrite("In monitoring mode. Press Ctrl+C to exit." & @CRLF) While 1 Sleep(10000) WEnd ;****************************************************************************** Func SINK_OnObjectReady ($objLatestEvent, $objAsyncContext) ;Trap asynchronous events. Local $essai1, $essai2 $objAsyncContextItem = $objAsyncContext.Item ("hostname") $filename= $objLatestEvent.TargetInstance.Properties_.item("Name").value ConsoleWrite($filename & @CRLF) EndFunc ;==>SINK_OnObjectReady Func sink_onprogress ($iUpperBound, $iCurrent, $strMessage, $objWbemAsyncContext) ConsoleWrite("progress ... " & @CRLF) ConsoleWrite($iUpperBound & @CRLF & $iCurrent & @CRLF & $strMessage & @CRLF & $objWbemAsyncContext & @CRLF) EndFunc ;==>sink_onprogress Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now