How to determine Windows.Diagnostics.Process from ServiceController
Posted
by
Alex
on Stack Overflow
See other posts from Stack Overflow
or by Alex
Published on 2009-10-15T17:53:41Z
Indexed on
2011/01/04
10:53 UTC
Read the original article
Hit count: 376
This is my first post, so let me start by saying HELLO!
I am writing a windows service to monitor the running state of a number of other windows services on the same server. I'd like to extend the application to also print some of the memory statistics of the services, but I'm having trouble working out how to map from a particular ServiceController object to its associated Diagnostics.Process object, which I think I need to determine the memory state.
I found out how to map from a ServiceController to the original image name, but a number of the services I am monitoring are started from the same image, so this won't be enough to determine the Process.
Does anyone know how to get a Process object from a given ServiceController? Perhaps by determining the PID of a service? Or else does anyone have another workaround for this problem?
Many thanks, Alex
© Stack Overflow or respective owner