473,410 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Get a process's child processes

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
Oct 20 '06 #1
5 7977
Hello Agnes,

Use WMI
Willy posted once a codesnipped for this

http://groups.google.com/group/micro...6272a9b7ecd77b

AHi,
A>
AIs there a way to get the current process's child processes?
A>
AOr given a user, get all the processes that are running as that user
Ausing C#?
A>
AThank you in advance!
A>
AAgnes
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
Oct 20 '06 #2
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.)
Oct 20 '06 #3

"Jack Robertson" <no_spam@_nospam.comwrote in message
news:Ov**************@TK2MSFTNGP05.phx.gbl...
|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.
Oct 21 '06 #4
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).
Oct 21 '06 #5

"Jake Weller" <no_spam@_nospam.comwrote in message
news:ua**************@TK2MSFTNGP03.phx.gbl...
|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.
Oct 21 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: John Lin | last post by:
Howdy, I want to know how to tell if a forked process is done. Actually, my real question is that I want to run a shell script inside of a python script, and after the shell script has...
1
by: Peter Åstrand | last post by:
There's a new PEP available: PEP 324: popen5 - New POSIX process module A copy is included below. Comments are appreciated. ---- PEP: 324 Title: popen5 - New POSIX process module
1
by: Markus Franz | last post by:
Hi. I created a little script: for currenturl in sys.argv: pid = os.fork() if pid == 0: signal.alarm(10) do_something() # placeholder for the download and print routine
11
by: Mike M | last post by:
Is it possible? In the parent process, I have a socket that binds, listens and then accepts new connections (which creates new sockets in the process). I want to be able to pass some of these new...
3
by: felixfix | last post by:
Hi all, I am just wondering if something is wrong with my program. What it bascially does is to output a fibonacci sequence base on the command-line output. If I give a 5, it will generate the...
9
by: Chris Jones | last post by:
I have a Windows executable written in C#. It is run by our customer in three ways: from Windows Explorer, as a scheduled task, or kicked off by another process. When the exe is started by the...
22
by: nd02tsk | last post by:
Hello! I have a couple of final ( I hope, for your sake ) questions regarding PostgreSQL. I understand PostgreSQL uses processes rather than threads. I found this statement in the archives: ...
8
by: mandydhaliwal | last post by:
Hi all, I am porting a win32 c++ program on Linux which first reads a list of processes and their paths from a file.Then this program should launch all of thesese processes. I tried to...
2
by: Fred Heida | last post by:
Hi, Question on Vista Run As Administrator. If i have exe which creates a child process, using the Process class, and this exe is Run As Asministror, is there a way to have the child process...
7
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.