Skip to content

PowerShell 7 not available #4697

@EnnexMB

Description

@EnnexMB

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

VS Code with the PowerShell extension is able to run PowerShell 5.1 code, but not PS 7 code, and does not allw me to switch to PS 7.

PowerShell Version

PS> $PSVersionTable 

Name                           Value
----                           -----
PSVersion                      5.1.22621.1778
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.1778
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Visual Studio Code Version

PS> code --version
1.81.1
6c3e3dba23e8fadc360aed75ce363ba185c49794
x64

Extension Version

PS> code --list-extensions --show-versions | Select-String powershell 

ms-vscode.powershell@2023.6.0

Steps to Reproduce

  1. Running in Windows 11 Pro 64.
  2. Installed PowerShell 7 and VS Code. I'm able to run PS 7 directly in Windows, which brings up a window titled "PowerShell 7 (x64)".
  3. In VS Code, installed the PowerShell extension.
  4. In VS Code, I'm able to run Windows PowerShell 5.1, but PS 7 does not appear to be available.
  5. I know VS Code is running PS 5.1 and not 7 because when I call Get-Content ... -AsByteStream, it doesn't recognize the parameter AsByteStream.
  6. In VS Code, under "Get Started with PowerShell", there's an item, "Switch Sessions", which says, "To switch between PowerShell 7 and Windows PowerShell 5.1, use the menu: 'Open PowerShell Sessions Menu'" When I click on that button, I get a menu at the top that offers two versions of Windows PowerShell, but no PS 7, as shown in the attached display image.

Screenshot 2023-08-11 111916_50%

Visuals

No response

Logs

1691799117-289d41fd-c657-4022-8f85-0e0dc89fe7521691799024611.zip

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions