How to switch to PowerShell 6 inside a remote PSSession

Welcome Forums General PowerShell Q&A How to switch to PowerShell 6 inside a remote PSSession

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
4 months ago.

  • Author
    Posts
  • #129902

    Participant
    Points: 342
    Helping Hand
    Rank: Contributor

    Hello,

    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?

  • #129941

    Moderator
    Points: 1,976
    Helping Hand
    Rank: Community Hero

    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
    pwsh.exe
    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
    
  • #130377

    Participant
    Points: 342
    Helping Hand
    Rank: Contributor

    Excellent!
    Works fine!
    Thanks

The topic ‘How to switch to PowerShell 6 inside a remote PSSession’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort