Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Import-PSSession fails with ParameterBindingException if it is running with PowerShell 5.1 #4195
Steps to reproduce
[Server Side (PowerShell 5.1)]
[Client Side (PowerShell 5.1)]
This doesn't happen if client is PowerShell 5.0 or lower version.
This happens if client powershell is 5.1 or above as a parameter ‘PowerShellVersion’ is added to argument for Get-FormatData wchich is called internally in the Import-PSSession. Then, "Get-FormatData -TypeName xx -PowerShellVersion 5.1" is performed in wsmprovhost.exe on server side. But, 'PowerShellVersion' is marked as unbound parameter in the RestrictedRemoteServer session. Then, ParameterBindingException is thrown from VerifyArgumentsProcessed().
0:005> sxe clr
You can use imported the following commands.
・Clear-Host (cls, clear)
Receive the following error when running Import-PSSession.
Import-PSSession : Running the Get-Command command in a remote session reported the following error: A parameter cannot be found that matches parameter name 'PowerShellVersion'.
This issue occurs only with PowerShell 5.1.