Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PowerShell not recognizing the SSH command that is in path and installed

I am trying to run the SSH command from the Power shell on Windows 11. I have the OpenSSH installed and this used to work until some update when it stopped. I get the following response:

C:\Users\ivan> ssh
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.
At line:1 char:1
+ ssh
+ ~~~
    + CategoryInfo          : ObjectNotFound: (ssh:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

However when I print the path variable OpenSSH directory is clearly in the path:

PS C:\Users\ivan> $env:path
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\usbipd-win\;C:\Program Files\dotnet\;

When I print the SYSTEMROOT:

PS C:\Users\ivan> $env:systemroot
C:\WINDOWS

And when I move manually to the directory which is %systemroot%\System32\OpenSSH\ and try to run the SSH it runs:

PS C:\Users\ivan> cd C:\windows\system32\OpenSSH\
PS C:\windows\system32\OpenSSH> ./ssh
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
           [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
           [-i identity_file] [-J [user@]host[:port]] [-L address]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-Q query_option] [-R address] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] destination [command]

My guess is that systemroot variable substitution goes sideways, but I am not sure how.

like image 555
Ivan Kvolik Avatar asked May 04 '26 18:05

Ivan Kvolik


1 Answers

after some research i've found this issue https://github.com/PowerShell/PowerShell/issues/11774 and like mentioned there the solution was to uninstall the 32bit PowerShell and install the 64bit version of Powershell.

If you have the 32bit version

Get-Item -Force C:\Windows\System32\OpenSSH\ssh.exe
# Fails with:
Get-Item: Cannot find path 'C:\Windows\System32\OpenSSH\ssh.exe' because it does not exist.
like image 72
rayphi Avatar answered May 07 '26 08:05

rayphi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!