I am experiencing a weird issue when attempting to run a .NET command line tool remotely using PsExec.
When running PsExec from command line, it runs and co
try adding -accepteula to your arguments to psexec
I don't know what the error is, but I have a hunch that if you redirect stderr (RedirectStandardError = true
) and read the stderr stream (like you do with stdout) it will tell you. Alternatively, while debugging leave CreateNoWindow = false
and maybe you'll see the console message (especially if it is waiting for a keypress; otherwise it might disappear too quickly to notice).
Note that you might need to set up async readers on stdout/stderr if the process isn't terminating. You can do that either on extra threads, or via the OutputDataReceived
/ ErrorDataReceived
events (you need to set EnableRaisingEvents
to true
also).
If that still doesn't work; you could try running with UseShellExecute=true
. This means you won't be able to redirect IO, so you might have to use >
/ >>
etc to pipe the output to a file (ideally in temp), then read the file.