Get a process's child processes

A

Agnes

Hi,

Is there a way to get the current process's child processes?

Or given a user, get all the processes that are running as that user using
C#?

Thank you in advance!

Agnes
 
M

Michael Nemtsev

Hello Agnes,

Use WMI
Willy posted once a codesnipped for this

http://groups.google.com/group/micr...read/thread/71ca5def3013974a/2a6272a9b7ecd77b

A> Hi,
A>
A> Is there a way to get the current process's child processes?
A>
A> Or given a user, get all the processes that are running as that user
A> using C#?
A>
A> Thank you in advance!
A>
A> Agnes
A>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
J

Jack Robertson

Use WMI
Willy posted once a codesnipped for this

WMI isn't installed by default on Win2003 Server so if that's a target OS
then it's an issue. I'm not sure what C# classes are available for doing
this if any, but the WinAPI is certainly available (e.g.,
"CreateToolhelp32Snapshot()", "EnumProcesses()", etc.)
 
W

Willy Denoyette [MVP]

|> Use WMI
| > Willy posted once a codesnipped for this
|
| WMI isn't installed by default on Win2003 Server so if that's a target OS
| then it's an issue. I'm not sure what C# classes are available for doing
| this if any, but the WinAPI is certainly available (e.g.,
| "CreateToolhelp32Snapshot()", "EnumProcesses()", etc.)
|
|

Not sure where you got this from. WMI is installed per default (more it's a
required service on W2K3 and higher) on W98me, W2K, XP, W2K3, it's an
optional install on NT4 (no longer supported anyway) and W98.


Willy.
 
J

Jake Weller

Not sure where you got this from. WMI is installed per default (more it's
a
required service on W2K3 and higher) on W98me, W2K, XP, W2K3, it's an
optional install on NT4 (no longer supported anyway) and W98.

Unless MSFT changed things recently this just isn't the case. On Windows
Server 2003 (not sure about the R2 version), you have to explicitly active
it via "Add/Remove Windows Components" on the "Add or Remove Programs"
panel. I'm certain of this not only having seen official MSFT documentation
on the subject, but having personally installed it many times (the OS itself
that is). WMI was definitely off by default after a fresh install and we
explicitly avoided its use for that reason. This is going back perhaps 1-2
years however but it seems unlikely MSFT would have changed it. If they did
then I stand corrected (though it's still an issue for anyone using the
older versions).
 
W

Willy Denoyette [MVP]

|> Not sure where you got this from. WMI is installed per default (more it's
| > a
| > required service on W2K3 and higher) on W98me, W2K, XP, W2K3, it's an
| > optional install on NT4 (no longer supported anyway) and W98.
|
| Unless MSFT changed things recently this just isn't the case. On Windows
| Server 2003 (not sure about the R2 version), you have to explicitly active
| it via "Add/Remove Windows Components" on the "Add or Remove Programs"
| panel. I'm certain of this not only having seen official MSFT
documentation
| on the subject, but having personally installed it many times (the OS
itself
| that is). WMI was definitely off by default after a fresh install and we
| explicitly avoided its use for that reason. This is going back perhaps 1-2
| years however but it seems unlikely MSFT would have changed it. If they
did
| then I stand corrected (though it's still an issue for anyone using the
| older versions).
|
|
You must be referring to something else I'm afraid, WMI is not an optional
component on WS2003 SP1 and R2, can't check WS2003 pre-SP1 though, but I
don't believe that it was an optional install on WS2003 pre-SP1, since it's
considered a system component on Windows 2000 and higher (up to and
including Longhorn).
The only optional components (for WMI on WS2003) are the WMI SNMP Provider
and the WMI Windows Installer Provider (default on XP). Note that, MSFT
removed the WMI ODBC Adapter and ADSI WMI Provider from WS2003.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top