platform agnostic remote execution
Background: We had to run a specific command across a few hundred systems of varying platforms and configurations.
For Linux systems, it's relatively easy -
is standard on nearly every distro (saying nearly because while I've never encountered a distro without it, I know someone out there has built some version of Linux without it).
Windows by default does not have
. You can use
to run a command on a remote machine, but that requires the host machine to be Windows.
While PowerShell is now supported on Linux/Posix systems, at the time of writing this, it does not support
I already have written a
application to execute commands across many systems in parallel, but it uses
to connect to the remote machines.
The application also includes an option to use
for remote Windows machines if the executing workstation is a Windows machine - but mine is not.
is supported by Windows - just not enabled by default. By installing the
server, you can then connect to the remote machine through SSH and be dropped into the command prompt.
Installation - Chocolatey
choco install openssh -y -params "/SSHServerFeature"
Installation - PowerShell
# Install OpenSSH Client
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
# Install OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Set-Service -Name sshd -StartupType 'Automatic'
Once the SSH server is running on the remote machine you will be able to connect just as ususal:
If using an AD account:
.last updated 2019-12-19T22:20:33+0000