Execute exe on remote machine

前端 未结 4 695
孤城傲影
孤城傲影 2020-12-07 03:55

I\'m trying to execute notepad.exe on a remote machine, but it\'s not working now. What am I missing?

var ui = new ImpersonateUser();
    //the process to re         


        
4条回答
  •  不思量自难忘°
    2020-12-07 04:22

    The answer was a combination from your replies. But the whole correct solution was:

            ProcessStartInfo info = new ProcessStartInfo("C:\\PsTools");
            info.FileName = @"C:\PsTools\psexec.exe";
            info.Arguments = @"\\" + serverName + @" -i C:\WINDOWS\notepad.exe";
            info.RedirectStandardOutput = true;
            info.UseShellExecute = false;
            Process p = Process.Start(info);
    

提交回复
热议问题