Skip to content

Using Enter-PSSession -ContainerId is hardcoded to powershell.exe #6669

Closed

Description

The code to connect to a container is hardcoded to start powershell.exe. Need to expose a parameter to allow starting pwsh.

Also, -ContainerId requires full hash and not just the partial hash which is a usability problem.

Steps to reproduce

docker run microsoft/windowsservercore
# get containerid
docker ps
enter-pssession -containerid <containerId>

Expected behavior

Ability to connect to PowerShell Core via PowerShell Direct

Actual behavior

Can only connect to Windows PowerShell

Environment data

Name                           Value
----                           -----
PSVersion                      6.1.0-preview.1
PSEdition                      Core
GitCommitId                    v6.1.0-preview.1
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

  1. added
    Issue-Enhancement
    WG-Remoting
    on Apr 17, 2018
  2. bergmeister commented on Jul 4, 2018

    @bergmeister
    Contributor

    The current cmdlet syntax is:

    Enter-PSSession [-ContainerId] <string> [-ConfigurationName <string>] [-RunAsAdministrator] [<CommonParameters>]

    The proposal would be to add a switch DoNotUseWindowsPowerShell to be able to use PowerShell Core. I know, the naming does not sound good (double negative, etc), but such a switch parameter is more useful as existing scripts can't be broken by changing the default and having to incorporate the word PowerShell Core in a ValidateSet is also not good if it gets renamed back to just PowerShell in the future. I am happy to take any suggestions

  3. MaximoTrinidad commented on Jul 5, 2018

    @MaximoTrinidad

    +1

    That sounds interesting! In the scenario of using winrm and having both PowerShell installed in Windows. I would see it practical to have a switch to pick which PowerShell to use.

    :)

  4. bergmeister commented on Jul 5, 2018

    @bergmeister
    Contributor

    Also, as far as I see, the same parameter would need to be added to at least the Invoke-Command, New-PSSession, Remove-PSSession and Get-PSSession cmdlets as well.
    I have a rough prototype that should (have not tested it yet) work here. Expect a PR in the next week(s).

  5. added
    Review - Committee
    and removed
    Review - Committee
    on Jul 9, 2018
  6. SteveL-MSFT commented on Mar 29, 2019

    @SteveL-MSFT
    MemberAuthor

    Closing this since #7241 provides a good enough solution

  7. added
    Resolution-Answered
    on May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-EnhancementResolution-AnsweredWG-Remoting

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions