PsExec open my remote machine process but application didn't start

user1860934 picture user1860934 · Oct 28, 2013 · Viewed 8.5k times · Source

I am using this code to open process in remote machine:

    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();

on the remote machine i can see that the process start but i cannot see my Application GUI.

Double click on the exe will open the GUI

enter image description here

Answer

jester picture jester · Oct 28, 2013

Try using psexec.exe with the -i switch :

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

or

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

use 1 instead of 0 if you are using vista or higher. User desktop runs in session 1 in vista or higher.