我試圖在遠程機器上執行notepad.exe,但現在無法正常工作。我錯過了什麼?在遠程機器上執行EXE
var ui = new ImpersonateUser();
//the process to restart
const string processName = "notepad.exe";
var serverName = "serverName";
try
{
//Use adbadmin for access
ui.Impersonate(_domain, _userName, _pass);
//Start the process
ProcessStartInfo info = new ProcessStartInfo("C:\\PsTools");
info.FileName = @"C:\PsTools\psexec.exe";
info.Arguments = @"""\\" + serverName + @"C:\WINDOWS\notepad.exe""";
info.RedirectStandardOutput = true;
info.UseShellExecute = false;
Process p = Process.Start(info);
lblStatusResponse.Text = "Service " + processName + " was restarted correctly.";
}
catch (Exception ex)
{
lblStatusResponse.Text = ex.ToString();
}
finally
{
ui.Undo();
}
這讓我也不例外,但我確實失去了一些東西......
是否在遠程機器上啓動了「服務器」服務? – 2014-09-11 08:10:53
有一件事,你需要一個C之前的空間:.. .. – 2014-09-11 08:11:42
@LorenzoDematté你對服務器服務意味着什麼? – MrProgram 2014-09-11 08:12:52