X Tutup
The Wayback Machine - https://web.archive.org/web/20251011151057/https://github.com/PowerShell/PowerShell/issues/26176
Skip to content

Invoke-Command aborts after 10 minutes #26176

@JohnnyDoesStuff

Description

@JohnnyDoesStuff

Prerequisites

Steps to reproduce

  1. Create a Hyper-V VM with a current version of Windows 11 (No network adapter needs to be connected)
  2. Install PowerShell 7.5.3 on the host
  3. Install PowerShell 7.5.3 in that VM.
  4. In the VM open an elevated shell and execute Enable-PSRemoting -SkipNetworkProfileCheck
  5. On the host run this command
    $session = New-PSSession -VMName NameOfMyVM
    Invoke-Command -Session $session -Command {
        while($true) {
            Get-Date
            Start-Sleep -Seconds 10
        }
    }
    
  6. Wait for 10 minutes

Expected behavior

The Invoke-Command still continues until we manually abort it

Actual behavior

This error gets thrown after the 10 minutes have expired `The background process reported an error with the following message: "The Hyper-V socket target process has ended.".`

Error details

Since PowerShell 7.5.3 we are experiencing an issue when executing long-running commands in Hyper-V VMs. After pretty exactly 10 minutes of usage the connection gets closed. It only happens if it is a single Invoke-Command that takes that much time. Running many short Invoke-Commands with the same session does not lead to this behaviour.

We are doing this on Windows 11 office computers (so no special server). On a few clients the issue does not seem to occur. We haven't found out yet what the important difference is. The issue is somehow also reproducable with PowerShell 5.1 so it may be that something underlying is the root-cause. When rolling back to PowerShell 7.5.2 we don't see this issue anymore.

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.3
PSEdition                      Core
GitCommitId                    7.5.3
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0


A computer not showing the behaviour has the same output

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup