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

Adam Hupp 1 Reputation point
2022-04-08T11:33:42.3+00:00

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?

Sysinternals
Sysinternals
Advanced system utilities to manage, troubleshoot, and diagnose Windows and Linux systems and applications.
1,238 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Simon Burbery 691 Reputation points
    2022-04-08T12:50:25.22+00:00

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


  2. MotoX80 36,291 Reputation points
    2022-04-09T13:14:37.617+00:00

    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 
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.