Why I cannot use command ssh in powershell 7.3.9

Hashrimi Ramsay 5 Reputation points
2023-11-04T05:12:48.1233333+00:00

I'm using Windows terminal, and recently updated PowerShell 7.3.8(now 7.3.9) as the shell.

Thing can be ensured:

  1. I had installed openssh,whose path has correctly added to the PATH.
  2. Openssh can be used successfully, no matter in the powershell of the past or the cmd right now.

YES, INDEED, THAT'S WHAT WEIRD:I could use ssh until I updated pwsh of version 7.3.8, at the same time I can use ssh on cmd of the same Windows Terminal, which means ssh has nothing wrong.

When I use the command ssh in pwsh, it returns:

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.

And when I try to print the environment value: echo $env:PATH it returns:

...C:\Windows\System32\OpenSSH;

How can that be?

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. MotoX80 36,291 Reputation points
    2023-11-04T17:19:09.6166667+00:00

    Does where.exe find the executable? Is your path properly formatted?

    PS C:\> where.exe ssh
    C:\Windows\System32\OpenSSH\ssh.exe
    PS C:\> ($env:path).split(";")
    C:\Program Files\PowerShell\7
    C:\Windows\system32
    C:\Windows
    C:\Windows\System32\Wbem
    C:\Windows\System32\WindowsPowerShell\v1.0\
    C:\Windows\System32\OpenSSH\
    C:\Program Files\PowerShell\7\
    C:\Users\Admin\AppData\Local\Microsoft\WindowsApps
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.