5

I'm using VSCode version 1.49.0 user setup on Widows Server 2012 R2. I use it for powershell development. I do not have this issue on my windows 10 laptop but do on the server where I need to do my dev work since I write code against the sharepoint 2013 on-premises object model.

I have the Windows8.1-KB3118401 installed WHen starting the console I get the following:

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe '-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', 'Import-Module 'c:\Users\first.last.vscode\extensions\ms-vscode.powershell-2020.6.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.6.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\first.last.vscode\extensions\ms-vscode.powershell-2020.6.0\modules' -EnableConsoleRepl -StartupBanner "=====> PowerShell Integrated Console v2020.6.0 <===== " -LogLevel 'Normal' -LogPath 'c:\Users\first.last.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1599836315-05dc7ac0-e011-4b28-8568-c8782ebeabc01599836314391\EditorServices.log' -SessionDetailsPath 'c:\Users\first.last.vscode\extensions\ms-vscode.powershell-2020.6.0\sessions\PSES-VSCode-8808-389325' -FeatureFlags @() ...

when I try to run a hello world test script I get:

Cannot debug or run a Powershell script until the PowerShell session has started. Wait for PowerShell session to finish starting and try again.

Source: PowerShell Preview (Extension)

It seems to be related to the Powershell 2020.6.0 extension from microsoft for as soon as I enable it the error is thrown.

Any idea on how to get my powershell working again?

2 Answers 2

5

Try adding the following in your User Settings (JSON).

{
  "powershell.integratedConsole.suppressStartupBanner": true,
}

Apparently, the Start-EditorServices command being executed with -StartupBanner parameter contains a character (<), which seems to be throwing an error.

The above setting instructs to suppress the startup banner, which resolves this error. I had to spend so many hours of scouring through the internet to finally reach to this discovery. Wish someone in the Powershell Core team would fix this.

Sign up to request clarification or add additional context in comments.

2 Comments

It worked for me following below: Go to path and edit > "C:\Users\Name\.vscode\argv.json" and add the line > "powershell.integratedConsole.suppressStar Thanks.
This does not help for me. ms-vscode.powershell v2023.6.0 VS Code Version: 1.80.0-insider (user setup) Commit: 61ba389b0a7108af0411c73ab30c7e4350051645 Date: 2023-06-16T09:46:56.229Z Electron: 22.5.7 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.19044
1

I was getting that error because I am using PowerShell 4 (anything less than 5 apparently has this issue).

You can find out what PS version you are using with this command: Get-Host | Select-Object Version

There is a guide of how to install an old version of the PowerShell extension here: https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/vscode/using-vscode?view=powershell-7.1#using-an-older-version-of-the-powershell-extension-for-windows-powershell-v3-and-v4

However in brief it says:

  1. Right click on the PowerShell extension and select "Install Another Version..."
  2. Pick version "2020.1.0".

It also suggests disabling auto update. X

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.