question

AdamHupp-3979 avatar image
0 Votes"
AdamHupp-3979 asked MotoX80 edited

Unable to use `psexec -i` to launch into interactive session

I'm connecting to a windows machine over ssh and trying to launch a GUI app in an existing interactive session using psexec -i. This fails in various ways depending on the program being run. In all of these cases my logged in user (as reported by whoami) is the same as the user of that interactive session.

  1. psexec -i 1 notepad.exe: notepad crashes without showing UI

  2. psexec -i 1 cmd.exe: I get a black box the size of a cmd.exe window, it never renders. If I look at the window title with "alt-tab", it does say this is an [Administrator] process which is not what I expected.

  3. psexec -i 1 <path to vscode>, it launches successfully but then raises a number of errors related to credential storage.

  4. psexec -s -i 1 cmd.exe: this launches fine, but the process is running as nt authority\system, which is not what I want.

  5. psexec -i 1 -u my_user -p my_pwd <path to vscode>: this works fine, but I can't require passwords and want to use ssh key-based auth instead.

Any ideas what I'm doing wrong, or better ways to accomplish this?



windows-sysinternals-pstools
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SimonBurbery-9608 avatar image
0 Votes"
SimonBurbery-9608 answered AdamHupp-3979 commented

You could try remote PowerShell:
Invoke-Command –ComputerName RemoteComputerName –ScriptBlock {Start-Process notepad.exe}

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Unfortunately, for this use the client needs to have minimal dependencies so I can't require installing linux powershell.

0 Votes 0 ·
MotoX80 avatar image
0 Votes"
MotoX80 answered MotoX80 edited

Just to be clear... you have a Windows PC and some account is logged on to the desktop. From a Linux machine you are using SSH to connect to the WinPC using that same account. From there you are using psexec and you are trying to launch some process that is then visible to the user who is logged on to the WinPC desktop. Correct?

You can use the task scheduler to launch an interactive process.

 SCHTASKS /create /tn Notepad /sc once /tr "notepad.exe" /ru interactive /st 00:00 /f
 SCHTASKS /run /tn Notepad
 SCHTASKS /delete /tn Notepad /f 
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Yes, that summary is correct. schtasks is my current solution and it works ok; my hope for psexec is that I could get clearer error reporting when things go wrong. Thanks!

0 Votes 0 ·
MotoX80 avatar image MotoX80 AdamHupp-3979 ·
  -i         Run the program so that it interacts with the desktop of the
             specified session on the remote system. If no session is
             specified the process runs in the console session.


Instead of "-i 1" try just "-i".






0 Votes 0 ·