Install Open SSH on Port 22 in Windows 2019

Exported on 26-Aug-2021 12:47:08

Parameters

Name Type Script Reference Default Value Comment
Win2019 - User Windows OS Credential win2019User
Windows 2019 - Test Machine Windows Server windows2019TestMachine

1 - Install and setup OpenSSH

The connection details have changed from the last step.

Login as user on node

  1. Connect via RDP
    mstsc /admin /v:Windows 2019 - Test Machine
  2. Login as user {Win2019 - User}
  3. Then open a command prompt
This is a PowerShell Script make sure you run it with powershell.exe Click start menu, enter "powershell" in the search bar, then select the powersehll program
Start-Process powershell -Verb runAs

Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

Start-Service sshd
Set-Service -Name sshd -StartupType Automatic

2 - Allow OpenSSH in firewall

Login as user on node

  1. Connect via RDP
    mstsc /admin /v:Windows 2019 - Test Machine
  2. Login as user {Win2019 - User}
  3. Then open a command prompt
This is a PowerShell Script make sure you run it with powershell.exe Click start menu, enter "powershell" in the search bar, then select the powersehll program
Start-Process powershell -Verb runAs

Get-NetFirewallRule -Name *ssh*
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22