Question

I'm connected from a Linux machine to a Windows machine through winexe. I log onto the Windows machine with a user on that machine. I can run cmd.exe or powershell scripts.

Now my problem: If I'm on the desktop of the machine, connect remotly to it and start some script through cmd/powershell then the cmd/powershell window is not visible to the desktop user. Both use the same user. I would like to have a visible window for the desktop user if a remote user started a script and it is running, so the commands and the output can be seen by the desktop user.

If I use the interactive argument of winexe then I get a message on the desktop that an interactive serivce needs attention, but when I look at it then there is only an empty cmd window. The output doesn't show.

Is there a way to show the cmd window that is used by the remote user?

Was it helpful?

Solution

Try executing your script using psexec and specifying the interactive session switch. Something like:

psexec.exe -i powershell.exe -executionpolicy bypass -file C:\myscript.ps1

psexec

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top