Sending commands from Ubuntu to Windows

6,689

Solution 1

You reminded me about winexe:

Download the tarball from the project page at http://sourceforge.net/projects/winexe/

wget "http://downloads.sourceforge.net/project/winexe/winexe-1.00.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fwinexe%2F&ts=1377024055&use_mirror=hivelocity"

I'm using a hot link for illustrative propose.

  1. Untar the file:

    tar zxf winexe*.tar.gz
    cd winexe*
    
  2. Configure it:

    ./autogen.sh
    ./configure
    
  3. Make it:

    make
    

Then you can either install it, or running it with ./winexe:

./winexe  -U "Administrator" //some-pc 'shutdown.exe'

It follows the same syntax as psexec Microsoft tool.

Solution 2

If you install cygwin on windows machines, and also install sshd, then you will be able to give any remote commands through ssh. From windows to linux you can give remote commands through putty (ssh).

Solution 3

Here are instructions for installation of Winexe, as summarised from http://www.aldeid.com/wiki/Winexe by Akisame (the quoted code snippets are copied verbatim from the original source):


For the people from the future I give thee the prerequisites (I had them except autoconf but it's a common problem so I'll just give them all).

sudo aptitude install build-essential autoconf checkinstall \
 python python-all python-dev python-all-dev python-setuptools libdcerpc-dev

Next you use the autogen.sh from source4 and follow the instructions from there on. When you're finished run

make basics bin/winexe

(this will take some time)

./bin/winexe -V

You should get "Version 4.0.0alpha11-GIT-UNKNOWN"

Share:
6,689

Related videos on Youtube

Akisame
Author by

Akisame

Updated on September 18, 2022

Comments

  • Akisame
    Akisame over 1 year

    On our home network we have one Windows 7 only PC and several computers with Ubuntu 13.04 (dual boot with backup Windows 7 for programs that can't be run using wine).

    We want to be able to send commands (like msg or shutdown etc.) to that Windows PC (and if possible we want that Windows 7 PC to be able to send commands to the Linux PCs).

    How do I do this?

    • Lupen
      Lupen over 4 years
      You've edited your question so that it now also includes an answer (which should have been posted as an answer). That makes the question harder to read and isn't how SE Question-and-Answer sites work so I've posted your answer as a real answer (community wiki so nobody gets the reputation).
    • Kulfy
      Kulfy over 4 years
      @Akisame If you plan to post an answer on your own, please feel free to do so. Such things are highly encouraged :)
    • Akisame
      Akisame over 4 years
      ooh wow.... This is a long time ago. This is my very first question on askubuntu. Back then I had to edit my question to answer people because I wasn't able to leave comments as a 1 reputation person.@Kulfy: I am good. but thanks for suggesting it. I don't really care about the reputation tbh
  • Lupen
    Lupen over 4 years
    smbclient doesn't allow arbitrary system commands to be run on remote MS Windows clients. It offers a limited set of internal commands (mostly related to file transfer), similar to an FTP client.
  • Kulfy
    Kulfy over 4 years
    Great!!! Your edit is now accepted. On a side note please append your comment in the answer as a disclaimer. +1 from my side :)
  • Lupen
    Lupen over 4 years
    @Kulfy I've edited the answer to provide appropriate attribution and use quote formatting to highlight the text that was copied verbatim from the original source material.