Today I implemented a JEA solution in PowerShell, but at the customer site we hit an error which I did not see in our test environments.

When we tried to execute Import-PSSession we got this error:

Running the Get-Command command in a remote session reported the following error: A parameter cannot be found that matches parameter name ‘PowerShellVersion’

Searching the net found this issue in github for PS6.0, but there is no information around a fix in PS5.1

https://github.com/PowerShell/PowerShell/issues/4195

I asked my friend Aleksandar Nikolic and he suggested to try and make a workaround for Get-FormatData. So we did, and we managed to make it work!

Workaround:

1. Open your role capability file

2. Make Get-FormatData cmdlet visible

  # Cmdlets to make visible when applied to a session
     VisibleCmdlets = 'Search-Alerts','Get-FormatData'   

3. Define a alias for the Get-formatdata function

 # Aliases to be defined when applied to a session
    AliasDefinitions = @{
        Name='Get-FormatData'
        Value='Microsoft.PowerShell.Utility\Get-FormatData'
    }