Windows is using sessions to display GUI applications to the users. Your ssh server is probably a windows service run by the SYSTEM user in the session 0, which is without a graphical display. Thus, you won't see the GUIs of the applications you are starting.
You can check this with the Sysinternals Process Explorer. After starting it (as admin), right click the column bar, click "select columns" and add the "Session", "UI Access", "User Name" and "Integrity Level". These information will show you for each process in which context that application is running ("Session"), whether it shows a window ("UI Access"), under which account is is executed ("User Name") and with what permissions ("Integrity Level", high means as admin).
Now, if you would like to execute an application from your ssh server in your user session, you can do so with another Sysinternals utility which is called PsExec: psexec -i <session number> -accepteula <application to execute>
. If you would like the process to run with your normal user you can also use the parameter -u
and you can strip permissions with -l
if you so desire. Check the help running psexec -?
.
To find out your sessions number, you can also run the command qwinsta
. This way, you don't need the Process Explorer GUI application.
For example, to run the calculator, do the following:
From an ssh session, run qwinsta
, which should give you something similar to this:
C:\>qwinsta
SESSIONNAME USERNAME ID STATE TYPE DEVICE
services 0 Disc
console john.doe 1 Active
So your session you would like to use is 1
in this example (it may be different for you). Then execute psexec -i 1 -accepteula calc.exe
. The calculator should now show up on your desktop. (the -accepteula
is absolutely needed on the first execution of the application. Without this, the application is going to show you the license agreement in a GUI window, which - of course - won't be displayed for the above mentioned reasons. On subsequent calls you can ignore the parameter, since once accepted the GUI window will not show up again)
If you prefix your autohotkey.exe
command with the psexec
as explained above I would expect the script to work, but I cannot test this myself since I don't know that application.
Best Answer
I'm not familiar with freeSSHd, but it most likely runs as a service. Starting with Windows Vista, services no longer share the same "session" with the logged on user, so any graphical application that is started by a service will be displayed in a separate session and will be invisible to the logged on user.
You should use the
runas
command when launching GIMP and specify the username and password of the user logged into the host PC. This will make GIMP start in the logged on user's session so that they can see and interact with it.