1

When i'm trying to do remote connection using invoke command icm -cn $ips -Credential $crd {hostname} i'm getting error as

An error has occurred which Windows PowerShell cannot handle. A remote session might have ended.
Srishti
  • 13
  • 3
  • Please show us the **FULL** error message. Also are you getting this error when using `Enter-PSSession`? – Theo Sep 09 '21 at 13:23
  • yeah, getting the same error for enter-pssession as well `Enter-PSSession : An error has occurred which Windows PowerShell cannot handle. A remote session might have ended. At line:11 char:1 + Enter-PSSession -ComputerName $ips -Credential $crd + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (:) [Enter-PSSession], PSRe motingDataStructureException + FullyQualifiedErrorId : System.Management.Automation.Remoting.PSRemoting DataStructureException,Microsoft.PowerShell.Commands.EnterPSSessionCommand` – Srishti Sep 09 '21 at 13:59
  • If this is on VM's, read [this](https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/powershell-direct#error-a-remote-session-might-have-ended) – Theo Sep 09 '21 at 14:01
  • I have already checked that article but not much helpful. – Srishti Sep 09 '21 at 14:06
  • Did you figure it out? – noobie Aug 25 '22 at 01:22

1 Answers1

0

Potential causes:

  • The virtual machine exists but is not running
  • The VM does not support PowerShell Direct (VM needs to be: Windows 10, Windows Server 2016, or later)
  • PowerShell isn't available in the guest yet
    • The operating system hasn't finished booting
    • The operating system can't boot correctly
    • Some boot time event needs user input

From: https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/powershell-direct#error-a-remote-session-might-have-ended

Fellipe Sanches
  • 7,395
  • 4
  • 32
  • 33