RSHD will do exactly what you are looking for. It can run in the context of the currently logged on user, and listens on a port for incoming connections from pre-authorised hosts. You could send a command (e.g. calc.exe) and have the app appear on the user's desktop.
Note that there are many implementations, and I wouldn't like to recommend one over another, some run as a service, but you will probably need to find one that runs in the context of the logged on user to do what you are asking.
Edit in response to the comment:
I've used this one in the past to do exactly as you are asking. It's lightweight, just a standalone binary.
Firstly, on the windows PC create a rhosts file and save it as c:\windowsrhosts
(note this isn't a typo, this file exists in the root of the C: drive). The file should contain the FQDN of the remote linux computer you are going to connect from, followed by the username, e.g.
remotepc.example.com bryan
Next, create a batch file that executes on logon, with the following command
rshd.exe -d
This will leave a command prompt window, which you can minimise.
Download a RSH client on your Linux PC (I've only tested using a Windows RSH client)
I've just tested, and have launched calc using the following command
rsh windowspc.example.com -l bryan calc
...and up popped calc.exe on the Windows desktop.
Best Answer
By design, you are not really supposed to be able to launch processes in other people's sessions.
(To clarify, even if you are logged on interactively at a computer desktop, and also have another separate network logon to the same machine at the same time using the same credentials, those still count as two different logon sessions.)
This is simply against the security model of Windows itself and attempts to subvert it will be frowned upon. So you'll not likely find an easy, supportable way of doing this. It is technically possible, but it involves running as Local System, copying another logged on user's security token, and launching a process with that alternate token. You would need the Windows API for this, which is pretty much the only thing Powershell isn't very good at. See
WTSQueryUserToken
andCreateProcessAsUser
in the Windows API for more detail on that.One other idea, so as not to totally pee in your Cheerios, you might be able to accomplish this by remotely creating a scheduled task that launches the process. See https://devblogs.microsoft.com/scripting/how-can-i-remotely-start-an-interactive-process/ for more info on that.
Edit: Oh, and I forgot... pretty sure PsExec with the
-i
parameter can do that. You have to supply the logon session ID. And have permissions to do it. It most likely uses the same Windows API that I mentioned, which leverages the fact that PsExec installs a temporary service that runs as Local System.