start exe in a Remote Session with PsExec

I would like to start an application remotely. I am using the following PsExec command:

PsExec \\computerOne -u Domain\User1 -p 123456 -x "C:\Windows\System32\calc.exe"

I tried to use -i so that the program interacts with the desktop:

PsExec \\computerOne -u Domain\User1 -i 123456 -x "C:\Windows\System32\calc.exe"

but that does not work. The error from the second example is:

calc.exe exited on computerOne with error code -1073741502"

If I omit the specification and just write the path of the exe, the process is listed in the taskmanager but I can not see any UI. Do I have to change any settings on my Desktop on which I want to start the program?


Solution 1:

What you are seeing is likely to be an effect of Session 0 isolation - psexec installs and starts a new service on the remote machine, but the default session it is starting your process in is 0, and thus unavailable to the currently logged on user (at least on from Windows Vista / Server 2008). You need to specify the session number after the -i parameter. You can query the currently logged on users (and their session numbers) using the quser /SERVER:computerOne command beforehand.

For quick&dirty testing you can assume that the session ID of the first interactively logged-on user is "1".

Solution 2:

You can also just take out the -x and replace with -I, it should open up PsExec \computerOne -u Domain\User1 -p 123456 -i "C:\Windows\System32\calc.exe"