unstdio.org

Not your standard io.

Make Windows Calls From Linux.

| Comments

I was recently taking a look a making remote calls from linux to a windows server. I found this nice little tool that makes this task pretty simple with winexe.  It’s basically like psexe but for linux. I was having problems getting version 0.80 working on some environments but v 0.90 seems to work on everything I have tried. (complied with a new version of glibc)  Here are the options.

winexe version 0.90This program may be freely redistributed under the terms of the GNU GPLUsage:

winexe [-?|--help] [--usage] [-d|--debuglevel DEBUGLEVEL]       [--debug-stderr] [-s|--configfile CONFIGFILE] [--option=name=value]        [-l|--log-basename LOGFILEBASE] [--leak-report] [--leak-report-full]        [-R|--name-resolve NAME-RESOLVE-ORDER]        [-O|--socket-options SOCKETOPTIONS] [-n|--netbiosname NETBIOSNAME]        [-W|--workgroup WORKGROUP] [--realm=REALM] [-i|--scope SCOPE]        [-m|--maxprotocol MAXPROTOCOL] [-U|--user [DOMAIN\]USERNAME[%PASSWORD]]        [-N|--no-pass] [--password=STRING] [-A|--authentication-file FILE]        [-S|--signing on|off|required] [-P|--machine-pass]        [--simple-bind-dn=STRING] [-k|--kerberos STRING]        [--use-security-mechanisms=STRING] [-V|--version] [--uninstall]        [--reinstall] [--system] [--runas=[DOMAIN\]USERNAME%PASSWORD]        [--interactive=0|1] [--ostype=0|1|2] //host command

Apparently it’s maintained by Stuart Henderson, but it looks somewhat dead? The site link doesn’t work. (returns blank page) http://eol.ovh.org/winexe/

Some ways to use it:

winexe -U DOMAIN/Username%Passwd //192.168.1.123 "ipconfig /all"




winexe -U DOMAIN/Username%Passwd //remote.com \
'cmd /C net stop SomeService && net start SomeService && echo AutoUpdates service restarted'

or get a shell,

winexe -U DOMAIN/Username%Passwd //remote.com 'cmd.exe'

or use it to configure synergy,

#!/bin/bash
OUT='winexe -U MAIN/User%Pass --runas MAIN/UserB%Pass //your-other-comp "ipconfig"'
IP=`$OUT |  grep "IPv4" | awk {'print $14'}`
synergyc $IP

This site also has some more info on it: http://opensourceinfo.blogspot.com/2010/01/winexe.html