2

I have recently installed PowerShell Core v6. I wanted to check it out and see what it is like and it is easy to switch to in Windows Terminal if I want to play with it. After installing Version 6 though, Visual Studio Code keeps using core for my integrated console, despite my settings.json file pointing to the powershell.exe file in System32. How can I fix this?

Our environment is all on version 5.1 and core is missing many features and cmdlets that are in 5.1. I need these when testing scripts I will deploy. I can add another terminal and it will use PowerShell 5.1, but since it is not integrated, running script blocks fails sometimes. Here is my settings.json file:

{
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "window.zoomLevel": 0,
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "explorer.confirmDragAndDrop": false,
    "files.autoSave": "afterDelay",
    "powershell.powerShellDefaultVersion": "Windows Powershell (x64)",
    "editor.accessibilitySupport": "off"
}
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131

1 Answers1

6

"terminal.integrated.shell.windows" applies to the integrated general-purpose terminal that is not specific to any particular development language.

You're looking for the "powershell.powerShellExePath" setting that is specific to the PowerShell extension for Visual Code and determines what PowerShell executable is used for the so-called PowerShell Integrated Console (PIC), which provides special features for PowerShell development and debugging.

Update: The powershell.powerShellExePath setting is now deprecated.

  • See the bottom section of this answer for the current solution, which describes both the settings.json method and the GUI method of controlling what PowerShell edition is used in the PIC.

Original, now obsolete answer:

Therefore, to make the PowerShell Integrated Console run Windows PowerShell, use:

"powershell.powerShellExePath": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",

Note: The first time in a session you activate an editor tab in which a file with PowerShell code is loaded, the PowerShell Integrated Console is loaded and remains active even when you switch to a non-PowerShell editor tab.

Use the Terminal panel's pop-up list in its top right corner to switch between running shells, e.g., in order to return to the integrated terminal's shell:

running shells

mklement0
  • 382,024
  • 64
  • 607
  • 775