Issues with running a PsExec process from code

前端 未结 2 940
一生所求
一生所求 2021-01-14 01:46

I am experiencing a weird issue when attempting to run a .NET command line tool remotely using PsExec.

  1. When running PsExec from command line, it runs and co

相关标签:
2条回答
  • 2021-01-14 02:31

    try adding -accepteula to your arguments to psexec

    0 讨论(0)
  • 2021-01-14 02:47

    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.

    0 讨论(0)
提交回复
热议问题