Psexec is not running an EXE program remotely

user3377627 picture user3377627 · Jul 7, 2014 · Viewed 21k times · Source

Check everywhere for a reason but nothing I found matches my specific problem. I have a program in C:\somefoldername\anothersubdirectory\andanother\ of the remote pc that I try to run using PSEXEC but it does not take. PSEXEC just does not want to run anything for me. Now if I run a ping or tasklist via psexec, it works, though obviously this is in PATH.

So I am putting in:

PSEXEC \\pcname C:\somefoldername\anothersubdirectory\andanother\program.exe

and nothing happens.

I even wrote a batch script that I tried running in two different ways.

Script is just:

@ECHO OFF
C:\somefoldername\anothersubdirectory\andanother\program.exe
EXIT

and I had it copied to the remote pc's main directory (maybe I need to put it in a folder) and then I tried running C:\batch.bat using:

PSEXEC \\pcname C:\batch.bat

I also tries running:

PSEXEC \\pcname -c \\servername\batch.bat

so it copies it over to PATH.

Neither worked.

Does any program I try to run via PSEXEC have to be in the remote pc's path?

I do have to admit that I have not done running an EXE remotely, but I have written lengthier scripts using psexec that use batch file on a server without any hiccups.

What is weird to is that the program I run has parameters and I task that runs through it, so I first taskkill it remotely, then I PSEXEC the SAME EXACT EXE as:

psexec \\pcname C:\...\program.exe -a -few -parameters ODBC

and that works. When I try to open just program.exe on its own, nope doesn't take.

I also did try psexecing iexplore.exe and that didn't work either.

Answer

user3377627 picture user3377627 · Jul 13, 2014

So gotta use the -i option. In addition to that, gotta use -p + -u or -s to load system hardware dependent gui. This is why large portions of the gui was missing, or I assume why.