Posh-SSH 4.0.0 is the first stable release of the v4 line. It moves the module to vanilla SSH.NET, rewrites trusted host management in C#, and keeps v3.2.7 scripts working unchanged, with the exceptions listed under Before you upgrade.
Thanks to everyone who contributed, especially @MVKozlov for the multi-key trusted host work and the SSH.NET 2025 migration.
⚠️ Before you upgrade
- Back up
~/.poshssh/hosts.json. v4.0 reads a v3hosts.jsonas is, but the first time the store is saved it rewrites the file in the new multi-key format, which v3.x cannot read. Keep a copy if you might downgrade. - Known host entries are now looked up per port. Connecting on a non-default port looks up
host:port, which matches the OpenSSH[host]:portconvention. Entries recorded under a bare host name are no longer found for non-standard ports. To fix this, re-accept the key with-AcceptKeyor add a[host]:portentry. - The registry functions were renamed with no alias.
Get-SSHRegistryKnownHostis nowGet-SSHRegistryTrustedHostStore, andConvert-SSHRegistryToJsonKnownHostis nowConvert-SSHRegistryToJSonTrustedHost. - The
-Forcehost key warning text changed. It now names the host (Host key for <computer> is not being verified since the Force switch was used.). Update any script that matches on the old text.
Library
- Built against vanilla SSH.NET 2025.1.0 from NuGet (up from 2024.0.0). The Cisco-patched
Renci.SshNetDev.dllfork is no longer needed and has been removed. - New runtime dependency
BouncyCastle.Cryptography.dll, shipped inAssembly/. - The legacy .NET Framework 4.7.2 project is gone. A single SDK-style project targets
netstandard2.0and runs on Windows PowerShell 5.1 and PowerShell 7.x on Windows, Linux and macOS.
Trusted host store
New-SSHTrustedHost,Add-SSHTrustedHost,Get-SSHTrustedHostandRemove-SSHTrustedHostare now C# binary cmdlets (they were PowerShell functions in v3.x).- A host can now have more than one host key, to support key rotation and hosts that use several key algorithms.
- The store cmdlets were renamed from "known host" to "trusted host store":
New-SSHMemoryTrustedHostStore,Get-SSHJsonTrustedHostStoreandGet-SSHOpenSSHTrustedHostStore. The v3 names still work as aliases. - Host keys are now displayed as SHA256 fingerprints by default (was MD5).
- Security fix: a trusted host entry with a blank key name skipped the fingerprint check, so it accepted any host key for that host. The fingerprint is now always checked.
- An
ssh-rsaentry now matches servers that negotiatersa-sha2-256/rsa-sha2-512(#632). This fixes "No matching host key algorithm" against OpenSSH 8.8+ servers. - When a host key is rejected, the error now shows the key type and fingerprint the server offered, the fingerprints already on record, and the command to run once you have verified the change.
v3.x script compatibility
Every v3.2.7 command and parameter was compared against this build, and each gap was closed with an alias or a positional parameter:
-KnownHostis now an explicit alias of-TrustedHostStoreonNew-SSHSession,New-SFTPSession,Get-SCPItemandSet-SCPItem.-KnownHostStoreand-KnowHostStorework again on the trusted host cmdlets.Get-SSHTrustedHostaccepts the store as a positional argument again.- The
Get-SSHJsonKnowHostalias is back.
New features
Get-SSHAlgorithmlists the algorithms the bundled SSH.NET supports. With-ComputerNameit also shows what the server offers and what the two have in common. It needs no credentials. Algorithm negotiation errors now point to it.- A session can use several authentication methods, for example a password and a key together.
- New
-Encodingparameter on the session and command cmdlets, for correct non-ASCII output. - New
-Overwriteswitch onGet-SCPItem, so you no longer have to disable host key verification with-Forcejust to overwrite a local file.
Bug fixes
- #604, #533: command timeouts in
Invoke-SSHCommand. - #582:
Get-SCPItem -PathType Filedownloads to a.partialfile and only replaces the destination once the download succeeds. - #633: the overwrite notice on
Get-SCPItemis now verbose output instead of a warning. - #174: the
-Forcehost key warning now names the host. - #381, #496: long-standing edge cases.
Get-SFTPItemcan download to an absolute Windows path again.Move-SFTPItemcan move an item into an existing directory.Remove-SSHTrustedHostno longer asks for confirmation by default, which also fixes aNullReferenceExceptionin non-interactive sessions.- Remote file names containing
*or:are saved with_in their place on Windows.
Build and tests
Build-Module.ps1builds, verifies every exported cmdlet, validates the manifest files and packages the module. It fails if the bundledRenci.SshNet.dlldoesn't match the versionPoshSSH.dllwas compiled against (the cause of the 3.2.6/3.2.7 mismatches).- The test suite now requires Pester 5 and passes with nothing skipped. There is a new integration suite, plus a Linux VM provisioning script covering 12 authentication setups.
Full details are in CHANGELOG.md.
Package: Posh-SSH-4.0.0.zip, SHA256 61D726C986086C670BBECCDDFB18FD9B6DAE7A8592C9A2840698B71658E1A9D9