在Windows Server 2016版本下执行,其它版本自行摸索
下载
点击Releases · PowerShell/Win32-OpenSSH (github.com),下载.msi后缀安装文件
安装
在CDM窗口中,切换到安装包所在目录,执行下面命令:
msiexec /i 安装包文件
用管理员身份打开PowerShell,执行下面命令,将SSH添加到系统环境变量Path:
[Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path",[System.EnvironmentVariableTarget]::Machine) + ';' + ${Env:ProgramFiles} + '\OpenSSH', [System.EnvironmentVariableTarget]::Machine)
详见:
Install Win32 OpenSSH Using MSI · PowerShell/Win32-OpenSSH Wiki · GitHub
验证
在PowerShell中,执行:Get-Service -Name ssh*,出现下图表示安装OK