Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
(title says "telet" rather than "telnet") –  Larsenal Jun 10 '09 at 21:55
add comment

7 Answers

up vote 4 down vote accepted

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

share|improve this answer
    
Thanks JR, I think rebooting might just be what I have to do. Its not slick but it would be acceptable especially if this is running late at night or something. Oh well. –  George Mauer Jun 11 '09 at 14:17
add comment

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.

psexec \\machine -u user -p password -i -w "C:\application" myapp.exe

You can download PsExec here.

share|improve this answer
add comment

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.

share|improve this answer
    
Is it possible to automate remote desktop though? –  George Mauer Jun 12 '09 at 18:37
    
Could you be more specific? What about the remote desktop session do you want to automate? –  Jay Michaud Jun 12 '09 at 22:24
add comment

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"

share|improve this answer
add comment

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).

share|improve this answer
add comment

Try the "start" command. It supports starting Windows apps, but I must confess I've never tested it over a telnet session.

share|improve this answer
    
Nope, GUI doesn't pop up. I've also tried runas with no effect. I'm not quite sure whats going on honestly. Ok, maybe the forms open on some hidden desktop somewhere but log4net should be logging to a file! Why in the world is that not happening? –  George Mauer Jun 10 '09 at 22:08
add comment

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).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.