c# - Can I get the ExecutablePath from a System.Management.EventArrivedEventArgs object? -
I am using a system. Management. Management Watcher to get the process ID and executable path for the startup process:
Private Wide startWatcher_EventArrived (Object Sender, EventArrivedEventArgs E) {String processID = e.NewEvent.Properties [" ProcessID "]. Value.ToString (); Var Finder = New Management Object Search (New WqlObjectQuery (String.Format ("Choose executable power from Win32_Process where ProcessID = {0}", processID)); Management Object Management Object = Faucet; Foreign Exchange (Objose Management Object in Investor.Get ()) {managementObject = obj; break; } Console. WrightLine (Management Object ["Executable Path"]); }
Use this WQL query:
Select the executable path from Win32_ProcessStartTrace
Is there any way to Can I still survive the object using the search, but what is available in the EventArrivedEventArgs object can still be found?
All I really need is the Process and ExecuatblePath for each new process begins. Is this the easiest way to get it?
Available properties are listed
Comments
Post a Comment