c# - PsExec 打开我的远程机器进程但应用程序没有启动

标签 c# sysinternals

我正在使用这段代码在远程机器上打开进程:

    Process process = new Process();
    ProcessStartInfo psi = new ProcessStartInfo(@"D:\tools\PsExec\PsExec.exe");
    psi.UseShellExecute = false;
    psi.RedirectStandardOutput = true;
    psi.RedirectStandardError = true;
    psi.RedirectStandardInput = true;
    psi.WindowStyle = ProcessWindowStyle.Minimized;
    psi.CreateNoWindow = true;
    psi.Arguments = "\\\\192.168.0.100 -u user-p pass D:\\app.exe";
    process.StartInfo = psi;
    process.Start();

在远程机器上我可以看到进程开始但我看不到我的应用程序 GUI

双击exe会打开GUI

enter image description here

最佳答案

尝试使用 psexec.exe-i 开关:

psi.Arguments = "\\\\192.168.0.100 -i -u user -p pass D:\\app.exe";

psi.Arguments = "\\\\192.168.0.100 -i 0 -u user -p pass D:\\app.exe";

如果您使用的是 vista 或更高版本,请使用 1 而不是 0。用户桌面在 vista 或更高版本的 session 1 中运行。

关于c# - PsExec 打开我的远程机器进程但应用程序没有启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19633218/

相关文章:

C# 删除 HTML 代码并合并段落

c# - EntityState 必须设置为 null、Created(对于 Create 消息)或 Changed(对于 Update 消息)

c# - 如何在 C# 上使对象线程安全?

windows - Procmon 的命令行版本

powershell - 在远程 PC 上运行 PowerShell 脚本

.net - Process Monitor 中的托管堆栈

windows - 是否有任何允许关闭远程机器上的 TCP 连接的 TCPvcon 模拟?

c# - 获取表单的父表单名称

data-structures - SYSTEM_HANDLE_INFORMATION 结构

c# - Windows Phone 7 中的列表框滚动到结尾