Prerequisites
Steps to reproduce
Enter-PSSession -VMName 'testvm' -Credential $credential ends with an error message. Changing the VMName or omit the Credential flag doesn't fix it.
Expected behavior
Actual behavior
Error: "Enter-PSSession: Unable to cast object of type 'System.String' to type 'VMState'."
Error details
Exception :
Type : System.InvalidCastException
TargetSite :
Name : GetRunspaceForVMSession
DeclaringType : [Microsoft.PowerShell.Commands.EnterPSSessionCommand]
MemberType : Method
Module : System.Management.Automation.dll
Message : Unable to cast object of type 'System.String' to type 'VMState'.
Source : System.Management.Automation
HResult : -2147467262
StackTrace :
at Microsoft.PowerShell.Commands.EnterPSSessionCommand.GetRunspaceForVMSession()
at Microsoft.PowerShell.Commands.EnterPSSessionCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
CategoryInfo : NotSpecified: (:) [Enter-PSSession], InvalidCastException
FullyQualifiedErrorId : System.InvalidCastException,Microsoft.PowerShell.Commands.EnterPSSessionCommand
InvocationInfo :
MyCommand : Enter-PSSession
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 9
Line : Enter-PSSession -VMName 'testvm' -Credential $credential
Statement : Enter-PSSession -VMName 'testvm' -Credential $credential
PositionMessage : At line:1 char:1
+ Enter-PSSession -VMName 'testvm' -Credential $credential
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Enter-PSSession
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
Environment data
PSVersion 7.4.3
PSEdition Core
GitCommitId 7.4.3
OS Microsoft Windows 10.0.14393
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
Enter-PSSession -VMName 'testvm' -Credential $credential ends with an error message. Changing the VMName or omit the Credential flag doesn't fix it.
Expected behavior
Shell into guest vmActual behavior
Error: "Enter-PSSession: Unable to cast object of type 'System.String' to type 'VMState'."Error details
Environment data
Visuals
No response