Link to home
Start Free TrialLog in
Avatar of Zack
ZackFlag for Australia

asked on

Getting an a powerShell IDE to run powershell scripts in Powershell v6

Hi EE,

How do redirect/configure the Powershell ISE or VSCode editors to run PowerShell scripts using PowerShell console (Powershell v6) terminal?

I have already tried the info in these posts:

https://techcommunity.microsoft.com/t5/ITOps-Talk-Blog/Configure-Visual-Studio-Code-to-run-PowerShell-for-Windows-and/ba-p/283258
https://4sysops.com/archives/vscode-as-a-console-for-powershell-core-6-part-1-multiple-shells/

And this works in VScode if I run the script from the command line.

But when I try to run the PS script with the intention of debugging it I get the following screen: see attached.

Basically what I need is when I hit the start debugging button F5 I need the terminal version to default to 'pwsh' (powershell v6)instead of PowerShell integrate

Below is my settings json file:

{
    "terminal.integrated.shell.windows": "c:/Program Files/PowerShell/6/pwsh.exe"
}


"shellLauncher.shells.windows": [
    {
        "shell": "C:\\Windows\\system32\\cmd.exe",
        "label": "cmd"
    },
    {
        "shell": "C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe",
        "label": "PowerShell 5.1"
    },
    {
        "shell": "C:\\Program Files\\PowerShell\\6\\pwsh.exe",
        "label": "PowerShell 6.0"       
    },
    {
        "shell": "C:\\Program Files\\Git\\bin\\bash.exe",
        "label": "Git bash"
    },

],

Open in new window

Any assistance is welcome.

Let me know if my query needs clarification.

Thank you.
Capture.PNG
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Powershell ISE was essentially deprecated as it will only work with Windows Powershell.

Several years ago, however, Powershell Support was added to Visual Studio, which is also cross-platform now, and so can write and debug Powershell code for both Windows Powershell and Powershell Core.  (Available here: https://code.visualstudio.com/Download)

This seems to be the path forward Microsoft is expecting us to use when working on PS Code; It's a shame that this is the path forward after getting us acquainted with a tool for essentially 10+ years of having PS ISE available on so many OSs that it is the go-to for most.

Shockingly I did all of my PS writing and testing in Notepad++, and only in the last couple of years have I started using ISE, just as they are phasing it out, it's been great for debugging tricky bits in larger scripts or fiddling with a small something or other without writing a full script and saving it, and you could have it available as needed without much effort.
Avatar of Zack

ASKER

Hi Guys,

Cheers Ben for the clarification and big thanks to oDBA for the solution.