Skip to content

Watching events using WMI and WQL

Daniel

Asked Jul 19, 2008, 8:47 AM EDT1 answer
Share
LinkedInX

Here is my program, a very basic one:

SQL
ManagementBaseObject _mBaseObj;
ManagementClass _mClass;
ManagementEventWatcher _mEventWatcher;
EventQuery _eQuery;
_mClass = new ManagementClass("Win32_Process");

_eQuery = new EventQuery("SELECT * FROM __InstanceCreationEvent WHERE ISA \"Win32_Process\"");

_mEventWatcher = new ManagementEventWatcher(_eQuery);

_mEventWatcher.EventArrived += new EventArrivedEventHandler(_mEventWatcher_EventArrived);
_mEventWatcher.Start();

 

This program pops-up a "ManagementException was unhandled" - Unparsable Query.

I have no clue why this happens, so I would thank anyone who might help me resolving this issue.

thx guyz. 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    I happened across your post while working on a project to detect my Symbol Handheld Scanner(s) and thought that this might help you.  It was originally vb2005 that I used a conversion tool on....

    Code
    {
        WqlEventQuery Query3 = new WqlEventQuery("SELECT * FROM __InstanceOperationEvent WITHIN 1 " + "WHERE TargetInstance ISA 'Win32_Process'");
    }

    Hope this helps!

     

    D

    0