-UseWindowsPowerShell:$false not respected in New-PSSession · Issue #26464 · PowerShell/PowerShell · GitHub
Skip to content

-UseWindowsPowerShell:$false not respected in New-PSSession #26464

Description

@yotsuda

Prerequisites

Steps to reproduce

This is a sub-issue of #25242.

The cmdlet New-PSSession does not respect explicit $false values for the -UseWindowsPowerShell switch parameter.

PS> $session = New-PSSession -UseWindowsPowerShell:$false
PS> $session.Runspace.ConnectionInfo.ShellUri

Expected behavior

PS> $session = New-PSSession -UseWindowsPowerShell:$false
PS> $session.Runspace.ConnectionInfo.ShellUri
http://schemas.microsoft.com/powershell/Microsoft.PowerShell

-UseWindowsPowerShell:$false should behave the same as omitting the -UseWindowsPowerShell switch, creating a session with the default PowerShell endpoint.

Actual behavior

PS> $session = New-PSSession -UseWindowsPowerShell:$false
PS> $session.Runspace.ConnectionInfo.ShellUri
http://schemas.microsoft.com/powershell/Microsoft.PowerShell.Workflow

-UseWindowsPowerShell:$false behaves the same as -UseWindowsPowerShell or -UseWindowsPowerShell:$true, creating a session with Windows PowerShell 5.1 endpoint.

Error details

No error is thrown. The cmdlet executes but ignores the explicit $false value.

Environment data

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.5.4
PSEdition                      Core
GitCommitId                    7.5.4
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions