I have a GUI application running on a windows XP client machine. I would like to telnet in, shut it down, pull some files over via ftp and then start it up again.
It's that last part that I'm having problems with as it seems like starting any GUI app from telnet "starts" it only in the sense that it is added to the process list. It does not pop up forms or really start doing anything (like writing log files).
Try it yourself. Telnet localhost => notepad.exe
Is there a simple way around this limitation? I also have RAdmin installed on all these machines, maybe there's a way to somehow use it? I doubt it since this is for an automation script and my experience is that RAdmin has 0 support for this.
By the way, I started this discussion on stackoverflow and it was recommended to me that you guys might know a thing or two about this.
It looks like this is not possible with the Windows telnet service. I even tested running the service under the local system account with "interact with desktop" enabled, but that did not work (which is fine as it would have serious security implications).
As an alternative to using telnet, I would recommend PsExec. PsExec is part of the SysInternal tools now managed by Microsoft. Use the -i option to enable desktop interaction.
You can download PsExec here.
See http://msdn.microsoft.com/en-us/library/ms687096(VS.85).aspx for a long and detailed though ultimately unhelpful description of what is happening when you launch apps from a telnet session. Many years ago I wrote a telnet server for Windows NT3.50 and I learned all this stuff the hard way :-)
I think you need to look again at what you're trying to do. From your description I'd guess that you have some GUI app being run by a logged in user and you want to kill it so you can do some maintenance then restart it. Killing it is easy as you can just kill the process. Restarting it in any useful way is harder. Could you set the PC to autologin and run the app from the Start Menu? Then you could just restart the PC when you've grabbed your files. I'm somewhat ashamed to admit this is what I did under similar circumstances.
JR
This shouldn't be possible to interact with any GUI apps because the telnet server doesn't provide you with access to a window station in which the GUI app run. In order to run a remote Windows GUI app, you need to start it within a terminal services session (or similar).
Do you have to use Telnet? Remote Desktop would allow you to stop and start the program interactively, and you could still use FTP to move the files. The downside: the remote computer will be locked once you disconnect, and if you log off, the program will stop running.
as mentioned above PsExec (sysinternals) provides the solution it is the -i flag which allows the gui creation on the target
with the -d flag your call doesn't hang (background execution) as it would else wait for the application termination
now for secure remote execution you might want to execute it though ssh for windows in this case freeSSHD is a solution mind to execute it as the target user so all spawning happens with the same user (don't execute freeSSHD as SYSTEM but with yourUsername)
an example of Acrobat executed from within putty
C:\PsExec.exe \\127.0.0.1 -d -i "C:\Program Files\...\AcroRd32.exe"
one other thing to possibly consider using psexec is that v1.55 did not support session ID where as the current one v1.9x does
so instead of "-i" it might be for
xp/nt systems "-i 0"
vista/7 systems "-i 1"
Try the "start" command. It supports starting Windows apps, but I must confess I've never tested it over a telnet session.
Windows Processes are linked to a Windows Session Id. Different processes can only interact if they share the same Session ID, or
Desktop
.This blog by Brian Bondy explains all of this, and more, including ways to circumvent all Windows Security (By running a Service under the Local System Account).
On the windows servers there exist a tool
schtasks.exe
Which is the task manager but in the command line.
This may be an alternative to run a gui app on a remote machine.
To start a gui app immediately the task should be "created" (schtasks.exe /create) with past time and subsequent issuing of the command
schtasks.exe /run
with same task name parameter.It is tested and it have been proven to be fully functional over a telnet connection.
the relevant help page https://technet.microsoft.com/en-us/library/cc772785(v=ws.10).aspx