-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Resolution-FixedThe issue is fixed.The issue is fixed.WG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
An SSH connection hangs when the session is unexpectedly terminated. For example, if you connect to a remote Linux or Mac OS X machine and execute the 'sudo reboot' command (or otherwise disrupt SSH or the computer), the connection will hang with the message 'Connection to computername.domainname.com closed by remote host.' After this point, no further PowerShell commands will work. Ctrl+C also doesn't help in this situation.
$s = new-PSSession -HostName 'testcomputername.dom.com' -Options @{ StrictHostKeyChecking = 'no'; UserKnownHostsFile = '\\.\NUL'} -UserName 'username' -ConnectingTimeout 5000
Invoke-Command -Session $s -ScriptBlock {get-host; Start-Sleep -Seconds 1; sudo reboot
Expected behavior
Connection error and stop cmdletActual behavior
HangingError details
Not error, just hanging.Environment data
Name Value
---- -----
PSVersion 7.5.3
PSEdition Core
GitCommitId 7.5.3
OS Microsoft Windows 10.0.20348
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
The problem also occurs on older versions.Visuals

Metadata
Metadata
Assignees
Labels
Resolution-FixedThe issue is fixed.The issue is fixed.WG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer