Setting up OpenSSH on Windows Server 2016

PS C:\> Invoke-WebRequest https://githu
b.com/PowerShell/Win32-OpenSSH/releases/download/v0.0.22.0/OpenSSH-Win64.zip -OutFile openssh.zip
PS C:\> Expand-Archive .\openssh.zip 'C:\Program Files\'
PS C:\> ($env:path).split(;)
PS C:\> $oldpath = (Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment -Name PATH).path
PS C:\> $newpath = $oldpath;C:\Program Files\OpenSSH-Win64\
PS C:\> Set-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment -Name PATH -Value $newPath
$env:path+='c:this'
PS C:\> ($env:path).split(;)
PS C:\> cd 'C:\Program Files\OpenSSH-Win64\'
PS C:\Program Files\OpenSSL-Win64> .\install-sshd.ps1
PS C:\Program Files\OpenSSL-Win64> .\ssh-keygen.exe -A
PS C:\> Start-Service -Name sshd
PS C:\> Set-Service -Name "sshd" -StartupType automatic
PS C:\> Get-WMIObject win32_service -Filter "name = 'sshd'"
PS C:\> Get-WMIObject win32_service | Format-Table Name, StartMode -auto
PS C:\> netsh advfirewall firewall add rule name="Open Port 22" dir=in action=allow protocol=TCP localport=22

References