How to switch to PowerShell 6 inside a remote PSSession


Did anybody find out how to switch from PowerShell 5.1 to PowerShell 6.x inside a PSSession?

When I use pwsh, everything runs without error and shows me that PowerShell 6.1 is loaded.

But when I check the $PSVersionTable variable, I am still inside PowerShell 5.1.

Furthermore, when I try to load the WindowsCompatibility module, it says that the current version is 5.1.

Any hint?

I can reproduce this, seems like an issue or no supported now. But I was able to do this in another way.

Create a PowerShell endpoint using PowerShell core
Then connect to that end point from 5.1

# from remote server
New-PSSessionConfigurationFile -Path C:\Temp\ps6.pssc
Register-PSSessionConfiguration -Path C:\Temp\ps6.pssc -Name ps6

# then from client
Enter-PSSession -ComputerName server -ConfigurationName ps6

Works fine!