471,607 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,607 software developers and data experts.

Using ManagementEventWatcher() to monitor more than 1 service

Dear all,

I need to write a watchdog program to monitor several services. Restart the
services if they are stopped by any reason. I got a sample code as follows

watcher = new ManagementEventWatcher("SELECT * FROM __InstanceOperationEvent
WITHIN 4 WHERE TargetInstance ISA 'Win32_Service' AND Targetinstance.Name =
'MyService' AND TargetInstance.State= 'Stopped'");

watcher.EventArrived += new
System.Management.EventArrivedEventHandler(this.Pr ocessStopped);

watcher.Start();

The above works for only one service “MyService”. How can I enhance the
code in order to watch more than 1 service

Thanks for any help.

Tedmond

Feb 6 '06 #1
0 1971

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Charles Law | last post: by
25 posts views Thread by vooose | last post: by
1 post views Thread by Mike Stephens | last post: by
1 post views Thread by Mis Dep. | last post: by
3 posts views Thread by Chris Dunaway | last post: by
reply views Thread by =?Utf-8?B?Um9i?= | last post: by
reply views Thread by iCodeSharp | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.