详情参考:https://learn.microsoft.com/zh-cn/windows-server/administration/openssh/openssh_install_firstuse
(1) 打开设置 选择应用

(2)可选功能

(3)添加功能 > openssh > 安装

1. 以管理员身份运行 PowerShell,输入以下命令
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
如果两者均未安装,则次返回以下输出

2. 根据需要安装服务器或客户端组件
# Install the OpenSSH Client
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
# Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
3. 启动并配置OpenSSH 服务 使用ssh service 命令 启动服务
# Start the sshd service
Start-Service sshd
# OPTIONAL but recommended:
Set-Service -Name sshd -StartupType 'Automatic'
# Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}
https://github.com/PowerShell/Win32-OpenSSH/releases

powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
成功后如下图

sc config sshd start= auto
net start sshd

使用 ssh 用户名@远程主机ip 命令登录
输入密码即可