Immi

Immi

  • NA
  • 10
  • 0

Windows Service stops triggering monitoring event for starting process

Sep 21 2010 5:20 AM

I am developing a Windows Service Application in VB.net (using WMI). The application monitors for occurrence (Start) of any new event/ process in Win32 environment. The code which I am using for handling this monitoring event is as under:-

WithEvents Watcher As ManagementEventWatcher

Watcher = New ManagementEventWatcher(New WqlEventQuery("Select * From Win32_ProcessStartTrace"))

AddHandlerWatcher.EventArrived,AddressOf ManagementWatcher_StartEventArrived

Watcher.Start()

The problem which I have been facing is that the application works fine in case of service installation/un-installation, begin and stop, at its first run i.e. systems startup but stops triggering monitoring event for starting processes, if we un-install and then again install and begin the service after span of some time (5-10 Mins). Moreover, the service is responding/triggering all remaining events, except the aforementioned monitoring event.

 The odd behavior of the service will remain to continue until and unless I reboot my computer.

Please help me in this regard.