To enter a PowerShell remoting session:
Enter-PSSession -VMName NameOfVMI've played with this a bit before and it's pretty cool. I've never had any issues with it. However, today when working with some VMs provided for a course I'm working on I got longer version of this error when trying to connect:
Enter-PSSession : An error has occurred which Windows PowerShell cannot handle. A remote session might have ended.This same error message is provided if your authentication credentials fail. So, I reset the local administrator password on the VM, but no fix.
+ FullyQualifiedErrorId : CreateRemoteRunspaceForVMFailed,Microsoft.PowerShell.Commands.EnterPSSessionCommand
This was a generation 1 VM given to me. So, my first throught is that maybe its the generation of VM. Nope. I tested with other generation 1 and generation 2 VMs and all worked fine.
What it finally ended up being was the version of VM. The VM was built on a Windows Server 2012 R2 host. So, it was version 5 rather than version 7.1 for the VMs that I had created.
To view the version:
Get-VM | FT Name,VersionTo update the version:
Update-VMVersion NameOfVMAfter updating the VM to from version 5 to version 7.1 PowerShell Direct worked just like it is supposed to. This is worth noting because none of the articles about PowerShell Direct mention the version as a required.
WORKS SUPER. THANKS A LOT
ReplyDeleteBut I just realised..the Host and the VMs must have the latest PS version installed otherwise, there is going to be issues connecting to the vms. For instance, if the Host has PS v.5 and the VM has PS 4. the connection with enter-newPSsession wont work.
ReplyDeleteI think PowerShell Direct is limited to just Windows 10 and Windows Server 2016 VMs (which come with PS v5. I don't think upgrading down versions like Win 2012 R2 to PSv5 v5 will allow PowerShell Direct.
DeleteGood bblog post
ReplyDelete