Windows: Using Powershell to Install SSH Client
The OpenSSH Client can be installed via Powershell from both server and desktop versions of Windows.
Prerequisites
1. Your device must be running Windows Server 2019 or Windows 10 (build 1809) or later versions.
2. PowerShell version 5.1 or later must be installed on the system where you intend to install the OpenSSH Client. You can read how to install Powershell in the "Installing PowerShell on Windows" guide.
3. The account you are using must have Administrator group privileges.
Primary Installation Method
1. Run PowerShell as an administrator.
2. Check if the OpenSSH Client needs to be installed by using the following command:
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Client*'
The command output will look something like this:
PS C:\WINDOWS\system32> Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Client*' Name : OpenSSH.Client~~~~0.0.1.0 State : NotPresent PS C:\WINDOWS\system32>
If the State shows as Installed, the OpenSSH Client is already installed on your system, and no further installation actions are required.
3. If the OpenSSH Client is not installed, proceed with the installation using the following command, using the Name value from the previous command as the parameter for -Name:
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
The installation process will begin, and upon completion, the output will appear as follows:
PS C:\WINDOWS\system32> Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0 Path : Online : True RestartNeeded : False PS C:\WINDOWS\system32>
If the RestartNeeded parameter is True or Possible after installation, a system reboot is required. If it is False, the OpenSSH Client is ready for use without rebooting.
To reboot, save all unsaved files and execute the command:
Restart-Computer
Your device will reboot, after which the OpenSSH Client will be ready for use.
Alternative Installation via PowerShell and DISM
1.Run PowerShell as an administrator.
2. Confirm the need to install the OpenSSH Client with the following command:
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Client*'
The command output will be as follows:
PS C:\WINDOWS\system32> Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Client*' Name : OpenSSH.Client~~~~0.0.1.0 State : NotPresent PS C:\WINDOWS\system32>
If the State is Installed, the OpenSSH Client is already installed, and no further installation actions are required.
3. Install the OpenSSH Client by executing the command below, substituting the /CapabilityName parameter with the Name value obtained from the previous command:
dism /online /Add-Capability /CapabilityName:OpenSSH.Client~~~~0.0.1.0
The installation process will begin, and upon completion, the output will appear as follows:
C:\WINDOWS\system32>dism /online /Add-Capability /CapabilityName:OpenSSH.Client~~~~0.0.1.0 Deployment Image Servicing and Management tool Version: 10.0.17755.1 Image Version: 10.0.17755.1 [==========================100.0%==========================] The operation completed successfully.
The OpenSSH Client is installed and ready for use. After that, you can proceed to create a key pair as described in the section "Creating Key Pair".