Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to execute, in an automated way, a command on a remote Windows 7 machine. Ideally I do not want to stay connected, but create a persistent session which I can later manually log back into (e.g. with remote desktop). I have been trying with psexec but no dice -- it freezes with various errors, sometimes without a message.

share|improve this question
What command, specifically? The exact behavior of the command and the way it's designed will heavily influence what options are available to you. – allquixotic Jul 27 '12 at 14:03
Specifically I want to open an R environment and launch a computation (R script). The environment is available both as a GUI or as a CMD prompt. – mitchus Jul 27 '12 at 15:23
up vote 1 down vote accepted

If you don't insist on creating the persistent session on the fly, you can manually create one by logging into your machine via RDP (remote desktop).

Step 1: Login to your computer using RDP to create the persistent session. When you close the RDP session, make sure you Disconnect and do not Log Off. Disconnect keeps your session running even when you aren't connected to it; Log Off terminates the session and all programs running within it.

Step 2: Run some kind of SSH server (e.g. OpenSSH) within your persistent session. OpenSSH is free and gets the job done. There are other non-free ones too.

Step 3: Use an ssh-agent and an SSH client (e.g. PuTTY) to script the command desired over SSH.

share|improve this answer
thanks for your response. Actually, this is exactly the way I am doing things now. However, I would like to automate this process, i.e. not have to log in manually. – mitchus Jul 30 '12 at 8:06
I guess you could use the rdesktop tool if you're running Linux on your client; you can automatically pass it your username and password, and set the user login script to fire off the computation. If you're only willing to run Windows as a client, no idea. – allquixotic Jul 30 '12 at 20:50
This link has a very nice setup. – mitchus Aug 3 '12 at 11:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .