我试图在远程机器上执行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