Hi,
My program (C#) must create a remote process and return the exit_code when it's finished.
Because I want to do this programmatically without using PsExec, I use "InvokeMethod("create"... from ManagementBaseObject class and then I use a ManagementEventWatcher class to get the "stop" event.
It works but...
If the remote command finishes quickly, I mean before my watcher is listening ; I'm not able to get the exit_code.
So, is there a way to execute a remote process with a delay before runtime in order to let the watcher run before the command execution?
I tried with a ProcessStartupInformation with 4 in the property "CreateFlag". Then the remote process is created in a suspend status but I never find a way to resume the remote thread. If somebody knows a solution to do that, it could be very very helpfully...
It seems that "AttachDebugger" method is another way to suspend a remote process but I don't know how to "detachDebugger".
Let me know if my explanations are not clear.
Thanks