469,142 Members | 1,138 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,142 developers. It's quick & easy.

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 1821

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 CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.