Questions tagged [managementeventwatcher]

`ManagementEventWatcher` class is from `System.Management` namespace. It can be used to subscribe to temporary WMI event notifications based on a specified event query.

ManagementEventWatcher class is from System.Management namespace. It can be used to subscribe to temporary WMI event notifications based on a specified event query.

37 questions
1
vote
1 answer

ManagementEventWatcher Memory Leak Issue

I might be using the term Memory Leak poorly but I'm not sure of any other way to describe it. I have wrote a Windows Service that uses the ManagementEventWatcher class to watch for the launch of a specific instance. Once it sees that instance, it…
1
vote
1 answer

How to start a process and set its main window as a child window of my app

I am starting a new process from my c# application. After the process created I set its main window as a child of my app window using the ManagementEventWatcher and SetParent. The problem is that when I write in my query WITHIN 2 every thing works…
e.s
  • 214
  • 3
  • 16
1
vote
0 answers

detect the win gui process that starts in windows using c#?ManagementEventWatcher

how to detect the process that have an interface like chrome , skype , torrent , explorer etc and get this process id , name , title , and parent id so what i did is that i get all the process list running in windows but i want to get the process…
north start
  • 71
  • 1
  • 9
1
vote
0 answers

ManagementEventWatcher Stop/Start/Disposing issues

I got really annoying issue here.. Consider following code: private static void _KindlePlugedEventWatcher_EventArrived( object sender, EventArrivedEventArgs e) { var plugedLogicalDisk =…
52hertz
  • 342
  • 4
  • 16
1
vote
0 answers

Invalid Class ManagementException when working with ManagementEventWatcher

I'm currently talking to another computer to see what events they have occurring. I have setup a Wql Event query like so below: Console.WriteLine("Polling...") Try Dim query As New WqlEventQuery("SELECT * FROM Lnl_AccessEvent") …
Kat
  • 2,460
  • 2
  • 36
  • 70
0
votes
0 answers

C# How to trigger an event when a docked usb is detected?

Currently I have MannagementEventWatchers for when there is an arrival or removal of a device, this part works. However I want to detect when a device is inserted already using the same ManagementEventWatcher. Currently I have: var…
Aiden-B
  • 41
  • 5
0
votes
1 answer

Alternative ways to enable an application to run with admin rights

I have a console app that works with monitoring all windows processes, waits for a specific one to appear and then work with it using UI Automation. It is only distributed to people who need it and are willing to install it so it does not do…
0
votes
0 answers

How to get event when word process stopped in vb.net

I am using ManagementEventWatcher to get message when process start and stop. I am successfully getting message when word process start it displays me File name and datetime. I have an issue in stopping process. Public Class Form1 Dim list As…
0
votes
1 answer

How to Handle "ManagementException was Unhandled by user code " Access denied in C#/ Vb.net

Getting Exception in my code How to Handle this exception as shown in image Public Class Form1 Dim processStartEvent As ManagementEventWatcher = New ManagementEventWatcher("SELECT * FROM Win32_ProcessStartTrace") Dim processStopEvent As…
0
votes
1 answer

How to get all instances of WINWORD Process in vb.net

I want to get all the instances of WINWORD processes. As shown in image i have running two windows in WINWORD process. I want to get their file name and path. Here is my code Dim processStartEvent As ManagementEventWatcher = New…
0
votes
1 answer

How to get Process executable path using ManagementEventWatcher

I know how to get ProcessID and ProcessName using ManagementEventWatcher. My code is working good.                                              What i need? I want to get a Path of Process. I want to Print ProcessID, ProcessName and ProcessPath. MY…
0
votes
1 answer

Cannot eject safely removed a USB memory stick when running a FileSystemWatcher on the drive

I need to create a record file activity on my USB drive. What I can do so far: It detects the insertion and extraction (detects the extraction after the memory was removed) of a USB memory using ManagementEventWatcher: using System.Management; var…
jafalcon
  • 21
  • 3
0
votes
1 answer

ManagementEventWatcher throws ManagementException with call to Stop()

I have the following piece of code that always throws an exception: The stacktrace is as follows: System.Management.ManagementException: Shutting down at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) …
Sai
  • 682
  • 2
  • 12
  • 35
0
votes
1 answer

How to get source and destination PID for process created using WMI?

A process could be spawned using WMI COM, below example of spawning calc.exe in VBS. The parent would be WmiPrvSE.exe that is WMI COM server rather than wscript.exe. The task is to hook below request for process creation. str = "calc.exe" Set…
0
votes
0 answers

C# callback on new process created?

I want for my callbackMethod() to run whenever a certain new external process is created. I was looking at the WMI apis, I have read to some extent I can attach an event handler whenever a process is started. I have looked at this answer: Is there…
Zeller33
  • 181
  • 2
  • 4
  • 16