Install OpenSSH via PowershellΒΆ

When you use ssh <username>@<hostname>.local (or ssh <username>@<IP address>) to connect to your Raspberry Pi, but the following error message appears.

ssh: The term 'ssh' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.

It means your computer system is too old and does not have OpenSSH pre-installed, you need to follow the tutorial below to install it manually.

  1. Type powershell in the search box of your Windows desktop, right click on the Windows PowerShell, and select Run as administrator from the menu that appears.

    ../_images/powershell_ssh.png
  2. Use the following command to install OpenSSH.Client.

    Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
    
  3. After installation, the following output will be returned.

    Path          :
    Online        : True
    RestartNeeded : False
    
  4. Verify the installation by using the following command.

    Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
    
  5. It now tells you that OpenSSH.Client has been successfully installed.

    Name  : OpenSSH.Client~~~~0.0.1.0
    State : Installed
    
    Name  : OpenSSH.Server~~~~0.0.1.0
    State : NotPresent
    

    Warning

    If the above prompt does not appear, it means that your Windows system is still too old, and you are advised to install a third-party SSH tool, like PuTTY.

  6. Now restart PowerShell and continue to run it as administrator. At this point you will be able to log in to your Raspberry Pi using the ssh command, where you will be prompted to enter the password you set up earlier.

    ../_images/powershell_login.png