vscode-powershell
vscode-powershell copied to clipboard
PowerShell 5.1 (x64) fails to start in VS Code 1.101.0 with PSES v3.0+ — no logs, EditorServicesHost.exe not launched
System Info
- VS Code version: 1.101.0 (64-bit, Stable)
- PowerShell extension version: 2025.0.0 (also tried 2023.10.2 and Insiders)
- PowerShell 5.1 version: 5.1.19041.5965 (x64)
- OS: Windows 10 64-bit
- PowerShell 7.5.1: works fine in VS Code
Problem Summary
PowerShell 5.1 (x64) fails to start in the PowerShell extension. The Integrated Console never appears. Logs show:
2025-06-16 17:39:01.606 [info] Visual Studio Code: v1.101.0 64-bit on Windows 64-bit 2025-06-16 17:39:01.606 [info] PowerShell Extension: v2025.0.0 2025-06-16 17:39:01.606 [info] Starting 'PowerShell (x64)' at: C:\Program Files\PowerShell\7\pwsh.exe 2025-06-16 17:39:02.105 [info] PowerShell process started with PID: 18672 2025-06-16 17:39:05.768 [info] Started PowerShell v7.5.1. 2025-06-16 17:39:06.935 [info] PowerShell is up-to-date. 2025-06-16 17:40:19.081 [info] Restarting session... 2025-06-16 17:40:19.136 [info] Starting 'PowerShell (x86)' at: C:\Program Files (x86)\PowerShell\7\pwsh.exe 2025-06-16 17:40:19.331 [info] PowerShell process started with PID: 28268 2025-06-16 17:40:22.033 [info] Started PowerShell v7.4.0. 2025-06-16 17:40:22.907 [info] Prompting to update PowerShell v7.4.0 to v7.5.1. 2025-06-16 17:40:38.762 [info] Restarting session... 2025-06-16 17:40:38.808 [info] Starting 'Windows PowerShell (x86)' at: C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\powershell.exe <<< this is where it hangs 2025-06-16 17:40:39.010 [info] PowerShell process started with PID: 23992 2025-06-16 17:42:04.695 [warning] Re-entered 'start' so waiting... <<< this is the debugger hanging after pressing F5
In an all new installation, with a dedicated PowerShell profile, this is the extension log ms-vscode.powershell appears to load without error:
2025-06-16 17:38:32.840 [info] Extension host with pid 26888 started 2025-06-16 17:38:32.840 [info] Skipping acquiring lock for c:\Users\Morten\AppData\Roaming\Code\User\workspaceStorage\58eda7e5534856e8773a6577f6c9b333. 2025-06-16 17:38:32.877 [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github' 2025-06-16 17:38:32.902 [info] ExtensionService#_doActivateExtension vscode.configuration-editing, startup: false, activationEvent: 'onLanguage:jsonc' 2025-06-16 17:38:32.912 [info] ExtensionService#_doActivateExtension vscode.json-language-features, startup: false, activationEvent: 'onLanguage:jsonc' 2025-06-16 17:38:32.967 [info] ExtensionService#_doActivateExtension vscode.typescript-language-features, startup: false, activationEvent: 'onLanguage:jsonc' 2025-06-16 17:38:33.018 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage' 2025-06-16 17:38:33.311 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '', root cause: vscode.git 2025-06-16 17:38:33.316 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '' 2025-06-16 17:38:33.357 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*' 2025-06-16 17:38:33.458 [info] Eager extensions activated 2025-06-16 17:38:33.460 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished' 2025-06-16 17:38:33.464 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished' 2025-06-16 17:38:33.482 [info] ExtensionService#_doActivateExtension aaron-bond.better-comments, startup: false, activationEvent: 'onStartupFinished' 2025-06-16 17:38:33.494 [info] ExtensionService#_doActivateExtension eamodio.gitlens, startup: false, activationEvent: 'onStartupFinished' 2025-06-16 17:38:33.625 [info] ExtensionService#_doActivateExtension GitHub.copilot, startup: false, activationEvent: 'onStartupFinished' 2025-06-16 17:38:35.223 [info] ExtensionService#_doActivateExtension GitHub.copilot-chat, startup: false, activationEvent: 'onStartupFinished' 2025-06-16 17:38:35.563 [info] ExtensionService#_doActivateExtension usernamehw.errorlens, startup: false, activationEvent: 'onStartupFinished' 2025-06-16 17:38:35.570 [info] ExtensionService#_doActivateExtension vscode-icons-team.vscode-icons, startup: false, activationEvent: 'onStartupFinished' 2025-06-16 17:39:01.450 [info] ExtensionService#_doActivateExtension ms-vscode.powershell, startup: false, activationEvent: 'onLanguage:powershell' 2025-06-16 17:39:55.455 [info] ExtensionService#_doActivateExtension vscode.debug-server-ready, startup: false, activationEvent: 'onDebugResolve' 2025-06-16 17:39:55.461 [info] ExtensionService#_doActivateExtension TylerLeonhardt.vscode-inline-values-powershell, startup: false, activationEvent: 'onDebugResolve:PowerShell'
c:\Users\Morten\AppData\Roaming\Code\logs\logs.zip: logs.zip
[PSES] Server initialisation failed.
Message: Pending response rejected since the connection got disposed
Code: -32097
- No
EditorServices.logor other PSES logs are created EditorServicesHost.exedoes not launch (even manually)- Happens in a clean user profile with
--user-data-dir,"editorServicesLogLevel": "Diagnostic", and no other extensions - PowerShell 5.1 launches fine manually (
$PSVersionTable.PSVersion = 5.1.19041.5965) - Execution policy is
RemoteSignedand profile is disabled/renamed - Cleaned all of:
%USERPROFILE%\.vscode\%APPDATA%\Code\%LOCALAPPDATA%\Code\%USERPROFILE%\AppData\Roaming\Code*
- Tried with multiple PowerShell extension versions and stable + insiders VS Code
- Starting VSCode as an administrator does not help
Settings
{
"powershell.powerShellAdditionalExePaths": {
"PowerShell 5.1 (x64)": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
},
"powershell.powerShellDefaultVersion": "PowerShell 5.1 (x64)",
"powershell.developer.editorServicesLogLevel": "Diagnostic"
}
(by default PS51 was attempted loaded using PowerShell at 'C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\powershell.exe' (which also failed, and which I can execute manually)
Steps to Reproduce
- Configure
settings.jsonfor 5.1 x64 as above - Open a
.ps1file - Observe no Integrated Console, no logs, no running EditorServices process
Expected Behavior
PowerShell 5.1 (x64) should launch and show the Integrated Console like PowerShell 7.x does.
Additional Info
This looks like a regression or crash in how PSES is hosted under .NET Framework when launched from VS Code. I’m happy to help trace further if needed.
I can run scripts in both 5.1 and 7.5 using Product: PowerShell Studio 2025 (64 Bit) Build: v5.9.256 OS: Windows 10.0.19045 PS Version(s): 5.1.19041.1, 7.5.1, 7.4.0
I haven't dug into it as deeply as @mmunchandersen, but I am having the same issue. Powershell extension is just not starting, unable to run powershell 5 scripts. I'm on Win11 but otherwise same platform.
I am in a corporate environment with UAC rights controlled by Admin By Request, which may not be relevant. But I find if I start vscode with Administrator rights, the extension starts and I can work as normal.
Same problem here, enable to start Powershell Extension terminal on Powershell 5. I rolled back to version 1.100.3 of vscode and everything is working.
Thanks @jppar1 for pointing out the obvious solution. I, too, rolled back to 1.100.3, (https://code.visualstudio.com/updates/v1_100) and now I can again switch between 5.1 and 7.5
( I also disabled vscode auto update: "update.mode": "manual" )
Consequences: GitHub Copilot Chat: Extension is not compatible with Code 1.100.3. Extension requires: ^1.101.0-20250523. This extension is using the API proposal 'languageModelDataPart' that is not compatible with the current version of VS Code.
This looks similar to this upstream bug: https://github.com/microsoft/vscode/issues/251446 something that seems to have broken between VS code versions which points us to the shell integration script but we don't know what the problem is yet. For now, can you try the version of VS code that was broken, but with shell integration explicitly disabled? That would help us confirm the first part of the theory. /cc @Tyriar
Try to comment setting powershell.powerShellDefaultVersion. It worked for me on several computers.
can you try the version of VS code that was broken, but with shell integration explicitly disabled?
I added:
"terminal.integrated.shellIntegration.enabled": false
to my settings.json and restarted vscode, but same behavior.
Try to comment setting
powershell.powerShellDefaultVersion. It worked for me on several computers.
That is already set in my settings.json
"powershell.powerShellDefaultVersion": "Windows PowerShell (x64)",
@EdCallahan
The value of Windows PowerShell (x64) does not work (dont know why) and causes the PS extension never start.
(https://github.com/EdCallahan) The value of
Windows PowerShell (x64)does not work (dont know why) and causes the PS extension never start.
@scriptingstudio Oh, I see what you meant. I commented that line out, and then I don't get the endless spinning behavior, but I get the PS7 terminal by default. The issue seems to be with Powershell 5
This looks similar to this upstream bug: microsoft/vscode#251446 something that seems to have broken between VS code versions which points us to the shell integration script but we don't know what the problem is yet. For now, can you try the version of VS code that was broken, but with shell integration explicitly disabled? That would help us confirm the first part of the theory. /cc @Tyriar
Please give me a little direction.
BTW I spun up a Windows 10 Pro virtual machine to simulate my environment. On this I can switch between PS5.1 and PS7.5 without problems in vscode: Version: 1.101.0 (system setup) Commit: dfaf44141ea9deb3b4096f7cd6d24e00c147a4b1 Date: 2025-06-11T15:00:50.123Z Electron: 35.5.1 ElectronBuildId: 11727614 Chromium: 134.0.6998.205 Node.js: 22.15.1 V8: 13.4.114.21-electron.0 OS: Windows_NT x64 10.0.19045
My coworker and I discussed this a bit, and our best guess is that something in the start of process of VS code is causing it to inherit a PSModulePath setting from PowerShell 7, as that would cause the exact error we're seeing. But we have no idea what exactly is doing that. We know we have seen this in the past when users have explicitly started VS code from within a PowerShell 7 session and then try to switch to PowerShell 5.1.
I know that this setting says it "has no effect on Windows" but I can reproduce the hang when it's set to its default (true) and it stops hanging when I set it to false. Can anyone else confirm?
terminal.integrated.inheritEnv
Yup, can consistently repro. With that setting on, when VS Code launches PowerShell 5.1:
Command line: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Import-Module 'c:\Users\andschwa\.vscode\extensions\ms-vscode.powershell-2025.0.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2025.0.0' -BundledModulesPath 'c:\Users\andschwa\.vscode\extensions\ms-vscode.powershell-2025.0.0\modules' -EnableConsoleRepl -StartupBanner \"PowerShell Extension v2025.0.0
Copyright (c) Microsoft Corporation.
https://aka.ms/vscode-powershell
Type 'help' to get help.
\" -LogLevel 'Warning' -LogPath 'c:\Users\andschwa\AppData\Roaming\Code\logs\20250619T112134\window1\exthost\ms-vscode.powershell' -SessionDetailsPath 'c:\Users\andschwa\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\sessions\PSES-VSCode-16108-890272.json' -FeatureFlags @() "
It's sending a PSModulePath with PowerShell 7 modules:
PSModulePath=C:\Users\andschwa\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules;C:\ES.DevProd\VMSetupScripts
Hence the hang. Ok @Tyriar what is up.
I know that this setting says it "has no effect on Windows" but I can reproduce the hang when it's set to its default (true) and it stops hanging when I set it to false. Can anyone else confirm?
terminal.integrated.inheritEnv
I have it working
I know that this setting says it "has no effect on Windows" but I can reproduce the hang when it's set to its default (true) and it stops hanging when I set it to false. Can anyone else confirm?
terminal.integrated.inheritEnv
Yes, setting that property to false in settings.json alleviates this issue on my system.
Well, I'm glad to at least have a direction. I'm still looking through the diff to see how this broke. Nothing has really jumped out at me yet. It's very clearly broken between two specific versions given the number of use reports. And our hypothesis about what was going on was correct: PowerShell 7 module paths are getting inherited by PowerShell 5.1 (which simply doesn't work). Why this particular setting that "has no effect on Windows" is having an effect...I'm guessing is due to the fact that this is an extension terminal, and so whatever checks the OS isn't happening there.
I know that this setting says it "has no effect on Windows" but I can reproduce the hang when it's set to its default (true) and it stops hanging when I set it to false. Can anyone else confirm?
terminal.integrated.inheritEnv
Thanks Andy, that workaround got it loading for me.
Two systems with different versions of vscode (1.101.0 broken / 1.98.2 working) Both have ps7 module folder in $env:psmodulepath, but only the new version is trying to load some of the modules. It's erroring out on Microsoft.PowerShell.security, event logs indicate these typedata values already exist so that import is failing and then the integrated terminal stops dead?
Works fine if I remove that module.
Hi, we traced it down to this change in VS Code that erroneously is forwarding PowerShell 7 environment variables to PowerShell 5.1, which obviously doesn't work as they're incompatible https://github.com/microsoft/vscode/commit/cbb88a30995ba7ac632bbc2b8435a04e784808ce
I'm having this issue as well and I can confirm that setting the terminal.integrated.inheritenv to $false got me up and running again.
Same here. Nothing helping. Notes
PS 5.1 - if starting vscode from Taskbar, StartMenu or by open with Code - not working, if executing from AppData\Local\Programs\Microsoft VS Code\bin\code.cmd it is working.... PS7 - Working for all cases.
This has been fixed upstream in https://github.com/microsoft/vscode/pull/252703. Until a new VS Code release comes out, you can use the suggested workaround.
This issue has been labeled as resolved, please verify the provided fix (or other reason).
This has been fixed upstream in microsoft/vscode#252703. Until a new VS Code release comes out, you can use the suggested workaround.
Thanks a lot @andyleejordan. Once released, is your recommendation to return the setting "terminal.integrated.inheritEnv" to true on a Windows machine?
This issue has been labeled as resolved, please verify the provided fix (or other reason).
This has been fixed upstream in microsoft/vscode#252703. Until a new VS Code release comes out, you can use the suggested workaround.
Thanks a lot @andyleejordan. Once released, is your recommendation to return the setting "terminal.integrated.inheritEnv" to true on a Windows machine?
I'd say so, yes, if only because I like to keep my settings minimally modified and it's not supposed to do anything, I'd reset it.
This issue has been labeled as resolved, please verify the provided fix (or other reason).
This issue has been labeled as needing fix verification and has not had any activity a week. It has been closed for housekeeping purposes.
Note sure if this is related, but also unable to launch PS5.1 Terminal error and Ouputs are below.
Going to try installing older v1.100.3 and will post if resolves.
Output:
2025-09-08 12:43:08.188 [info] Restarting session... 2025-09-08 12:43:08.189 [error] Error occurred while stopping language client: Error: Client is not running and can't be stopped. It's current state is: startFailed 2025-09-08 12:43:08.249 [info] Starting 'Windows PowerShell (x64)' at: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe 2025-09-08 12:43:08.504 [info] PowerShell process started with PID: 24488 2025-09-08 12:49:41.112 [info] Language service connection closed. 2025-09-08 12:49:41.113 [info] [PSES] [Error - 12:49:41 PM] Server initialization failed. 2025-09-08 12:49:41.113 [info] [PSES] Message: Pending response rejected since connection got disposed Code: -32097 2025-09-08 12:49:41.113 [info] [PSES] [Error - 12:49:41 PM] Connection to PowerShell Editor Services (the Extension Terminal) was closed. See below prompt to restart! 2025-09-08 12:49:41.113 [info] [PSES] [Error - 12:49:41 PM] PowerShell Editor Services Client client: couldn't create connection to server. 2025-09-08 12:49:41.113 [info] [PSES] Message: Pending response rejected since connection got disposed Code: -32097 2025-09-08 12:49:41.113 [error] Never finished startup! 2025-09-08 12:49:42.428 [warning] PowerShell process terminated or Extension Terminal was closed, PID: 24488
Terminal Error
Exception encountered starting EditorServices. Exception logged in C:\__w\1\s\src\PowerShellEditorServices.Hosting\Commands\StartEditorServicesCommand.cs on line 243 in EndProcessing: DryIoc.ContainerException: code: Error.UnableToFindCtorWithAllResolvableArgs; message: Unable to find most resolvable constructor also including passed input arguments `` when resolving: Singleton OmniSharp.Extensions.JsonRpc.Connection {DryIoc.IfUnresolved.ReturnDefault} as parameter "connection" FactoryId=64 (IsSingletonOrDependencyOfSingleton) in resolution root Singleton OmniSharp.Extensions.LanguageServer.Server.LanguageServer FactoryId=156 (IsSingletonOrDependencyOfSingleton, IsResolutionCall) from container without scope with Rules with {TrackingDisposableTransients, ResolveIEnumerableAsLazyEnumerable, SelectLastRegisteredFactory} and without {ThrowOnRegisteringDisposableTransient, VariantGenericTypesInResolvedCollection} with DefaultReuse=Scoped {Lifespan=100} with FactorySelector=SelectLastRegisteredFactory with Made={FactoryMethod=ConstructorWithResolvableArgumentsIncludingNonPublic}. at DryIoc.Throw.For[T](Boolean throwCondition, Int32 error, Object arg0, Object arg1, Object arg2, Object arg3) at DryIoc.FactoryMethod.MostResolvableConstructor(Request request, BindingFlags additionalToPublicAndInstance, Func3 condition)
at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request)
at DryIoc.Factory.GetExpressionOrDefault(Request request)
at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request)
at DryIoc.Factory.GetExpressionOrDefault(Request request)
at DryIoc.Container.ResolveAndCache(Int32 serviceTypeHash, Type serviceType, IfUnresolved ifUnresolved)
at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, IfUnresolved ifUnresolved)
at DryIoc.Resolver.Resolve[TService](IResolver resolver, IfUnresolved ifUnresolved)
at OmniSharp.Extensions.LanguageServer.Server.LanguageServer.<From>d__37.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Server.PsesLanguageServer.<StartAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesRunner.<CreateEditorServicesAndRunUntilShutdown>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Commands.StartEditorServicesCommand.EndProcessing()`
Didn't resolve. Created new Issue. See #5266