You could try remote PowerShell:
Invoke-Command –ComputerName RemoteComputerName –ScriptBlock {Start-Process notepad.exe}
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.
- psexec -i 1 notepad.exe: notepad crashes without showing UI
- 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.
- psexec -i 1 <path to vscode>, it launches successfully but then raises a number of errors related to credential storage.
- psexec -s -i 1 cmd.exe: this launches fine, but the process is running as nt authority\system, which is not what I want.
- 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
2 answers
Sort by: Most helpful
-
Simon Burbery 691 Reputation points
2022-04-08T12:50:25.22+00:00 -
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