Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have some command-line commands to execute on a Windows machine. The programs I need to run are only available on Windows.

Is there a way to easily to do something like I would do with SSH? Example of what I mean:

ssh username@windows-box.mycompany.com "remote command to execute"

...or do I have to Remote Desktop just to do this? (I'd like to run the commands programmatically from another computer rather than running them by hand.)

share|improve this question

migrated from stackoverflow.com Mar 31 '10 at 16:43

This question came from our site for professional and enthusiast programmers.

    
So, am I correct in reading between the lines that this "other computer" is not running windows, and that this is the reason you want/need to execute these commands remotely? –  SamB Apr 24 '10 at 15:41
    
@SamB: Yes, that's correct. I'm using Ubuntu on my main machine. –  Benjamin Oakes Apr 26 '10 at 19:52

5 Answers 5

up vote 7 down vote accepted

One approach, of course, is to actually run an SSH server on the windows box. But a more Windows-focused solution is a tool from the SysInternals folks (now part of Microsoft) called PsExec, which is designed to do exactly what you want.

share|improve this answer
1  
But PsExec only runs on Windows systems, right? –  SamB Apr 24 '10 at 15:49

You need a SSH server running on windows. like http://www.kpym.com/2/kpym/index.htm

There isnt any installed by default, And I have been using this for some time. it is good

share|improve this answer
    
Remark, this solution does not support key authentication. –  sorin Sep 7 '10 at 7:58

You can use the freesshd server from fresshd.com. It does work great, you will set-up the server in seconds :)

share|improve this answer
    
This looks as a nice solution but, the forum is down (cannot post) and it looks that it doesn't allow domain logins. –  sorin Apr 30 '10 at 12:36
    
Also, this is only 'free', meaning that every time you do a SSH it will display you a login message asking you to register(buy) it, you have to wait 5+ seconds to be able to continue. –  sorin Sep 7 '10 at 8:18
    
Remark, this is a slow SSH server. –  sorin Sep 7 '10 at 8:20
    
I tried freesshd - what you get is a login into a windows shell (cmd.exe?) with a fixed width that does not adapt to your terminal client, i.e. you get annoying line breaks mid-screen. Also, it's nowhere near a bash shell, so I figured, if I want a really usable ssh login into my windows box, I'll do it using cygwin, which I've done before. Granted, cygwin is a bit like an os inside the os, but it does make windows usable for a (unix) cmd line user. –  Eugene Beresovksy Mar 12 '13 at 9:01

I've had a lot of good experience installing cygwin and its sshd port. There are wrappers which will turn it into a windows service, and you get the bash shell as an extra.

http://chinese-watercolor.com/LRP/printsrv/cygwin-sshd.html is a decent starting point, you can evaluate if it is what you want.

share|improve this answer
    
Agreed, cygwin + ssh is nice and easy, and you get a conveniently unix-like shell and environment to run your programs from. If you like ssh, you probably already know Unix. –  apenwarr Mar 31 '10 at 15:24

you can install an SSH server on your Windows machines, or you can turn on Terminal services on windows (check your documentation), and then use Perl(or Python) to do a telnet to the server to execute your commands. See Net::Telnet(Perl) for examples of connecting through telnet

share|improve this answer
    
Well, it's all fine and dandy to say RTFM, but that would be easier if we could find said manual... any tips, such as the name of page and maybe an MSDN/Technet link -- especially now that it seems like MS may have finally learned the value of an URL? –  SamB Apr 24 '10 at 15:53
    
Also, isn't there some registry change needed to get it let you have more than one logged-in session at the same time on anything less than Server? I doubt MS would want to make the docs for that easy to find, assuming that there are any docs for that... –  SamB Apr 24 '10 at 20:27

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.