I’m looking for an easy way to find the process tree (as shown by tools like Process Explorer), in C# or other .NET language. It would also be useful to find the command-line arguments of another process (the StartInfo on System.Diagnostics.Process seems invalid for process other than the current process).
I think these things can only be done by invoking the win32 api, but I’d be happy to be proved wrong.
If you don’t want to P/Invoke, you can grab the parent Id’s with a performance counter:
now just put it into whatever tree structure want and you are done.