Search code examples
windowssshopensshpowershell-7

Cannot use SSH using Powershell 7


When I am trying to use ssh using powershell 7 it throws an error:

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

Error in powershell

But it is working fine for cmd and windows powershell Working on CMD Working on Windows Powershell

I have also noticed that I cannot change directory to OpenSSH (C:\Windows\System32\OpenSSH) Cannot cd to OpenSSH

I tried adding Openssh to the system Path, installing openssh client and server but did not work.

How can I fix it?


Solution

  • I finally resolved the issue.

    When installing PowerShell, I used to check the box that enables PowerShell remoting. However, this time I did not, and now SSH works.

    The solution is as follows:

    1. If OpenSSH is not installed (Doesn't even work in cmd) then follow this first: Get started with OpenSSH for Windows
    2. Uninstall PowerShell.
    3. Download the installer: PowerShell Latest Release.
    4. During installation, make sure to leave the PowerShell remoting box unchecked. Keep PowerShell remoting unchecked

    That was all I had to do.

    And here is the screenshot of it working: enter image description here