Accessing Windows console remotely from Linux
Have you ever needed to execute a command or to connect to an interactive text console on a remote Windows station?
Probably several times, and usually, you had to log in using either VNC or RDP (Remote Desktop Protocol – Microsoft Terminal Services). If you’re used to SSH, you may wonder why the overhead of a complete desktop is needed just to start a few text commands. Of course, there are free and commercial SSH servers for Windows, but one problem with them is that they have to be installed separately. Which may be too much work for a one-off task now and then. Are there any other methods of accessing a remote Window text console from your Linux station?
But hey, here comes winexe to the rescue! Below, accessing Windows CLI from Linux remotely (using a Windows domain account):
From the project’s page, “winexe remotely executes commands on WindowsNT/2000/XP/2003 systems from GNU/Linux (probably also other Unices capable to compile Samba4)“.
- note that winexe doesn’t offer encryption of any kind – you may want to use VPN to make sure your connection is secure,
- if your distribution doesn’t offer a packaged version of winexe (most distributions don’t), winexe homepage offers a static binary; on the other hand if you have a recent Linux distribution, the static binary will most probably not work for you – in that case, just build the tool from source,
- you can use winexe in your Linux scripts – this way, you may execute certain tasks on your Linux machines, other tasks on your Windows machines – all that as a part of one bigger task / script,
- winexe can be seen as a Linux equivalent of psexec (a similar tool available for Windows).
See the list of processes / logged in users. Useful if you want to log in via RDP but don’t want to interrupt user session. Useful in a script, to check more workstations.
winexe --system -U 'DOMAIN\Administrator%password' //192.168.10.21 "tasklist /V"
Start cmd.exe console:
winexe --system -U 'DOMAIN\Administrator%password' //192.168.10.21 cmd.exe