Skip to content

PowerShell won't start in VSCode #2849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
devedse opened this issue Aug 1, 2020 · 11 comments
Closed

PowerShell won't start in VSCode #2849

devedse opened this issue Aug 1, 2020 · 11 comments
Labels
Resolution-Duplicate Will close automatically.

Comments

@devedse
Copy link

devedse commented Aug 1, 2020

Issue Type: Bug

For some reason I can't use PowerShell inside vscode anymore. It just says "Loading the PowerShell extension is taking longer than expected". I've tried to reinstall the PowerShell extension and also VSCode. But none of these steps fixed it.

The issue happens whenever I open VSCode and try to do anything with a PowerShell file. (E.g. run it)

Anyway, when I first start VSCode this error shows up:

The terminal process "C:\Users\devedse\.dotnet\tools\pwsh.exe '-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', 'Import-Module 'c:\Users\devedse\.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\devedse\.vscode\extensions\ms-vscode.powershell-2020.6.0\modules' -EnableConsoleRepl -StartupBanner "=====> PowerShell Integrated Console v2020.6.0 <=====
" -LogLevel 'Normal' -LogPath 'c:\Users\devedse\.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1595937929-6615e5c2-13e0-4ed4-855a-50639ff76d871595937927968\EditorServices.log' -SessionDetailsPath 'c:\Users\devedse\.vscode\extensions\ms-vscode.powershell-2020.6.0\sessions\PSES-VSCode-21592-527545' -FeatureFlags @() '" terminated with exit code: 1.

Here's the files mentioned in C:\Users\devedse\.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1593015143-28af1fd9-3db7-4b8f-b7e9-83453c652a221593015141446\

EditorServices.log:

2020-06-24 18:12:27.026 +02:00 [INF] PowerShell runtime version: 5.1.18362.752, edition: Desktop
2020-06-24 18:12:27.831 +02:00 [INF] highlight handler loaded

StartEditorServices.log: (It's empty)


vscode-powershell.log:

24/06/2020 18:12:23 [NORMAL] - Language server starting --
24/06/2020 18:12:23 [NORMAL] -     PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\devedse\.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\devedse\.vscode\extensions\ms-vscode.powershell-2020.6.0\modules' -EnableConsoleRepl -StartupBanner "=====> PowerShell Integrated Console v2020.6.0 <=====
" -LogLevel 'Normal' -LogPath 'c:\Users\devedse\.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1593015143-28af1fd9-3db7-4b8f-b7e9-83453c652a221593015141446\EditorServices.log' -SessionDetailsPath 'c:\Users\devedse\.vscode\extensions\ms-vscode.powershell-2020.6.0\sessions\PSES-VSCode-18556-120503' -FeatureFlags @() 
24/06/2020 18:12:23 [NORMAL] -     PowerShell executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
24/06/2020 18:12:23 [NORMAL] -     PowerShell Editor Services args: Import-Module 'c:\Users\devedse\.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\devedse\.vscode\extensions\ms-vscode.powershell-2020.6.0\modules' -EnableConsoleRepl -StartupBanner "=====> PowerShell Integrated Console v2020.6.0 <=====
" -LogLevel 'Normal' -LogPath 'c:\Users\devedse\.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1593015143-28af1fd9-3db7-4b8f-b7e9-83453c652a221593015141446\EditorServices.log' -SessionDetailsPath 'c:\Users\devedse\.vscode\extensions\ms-vscode.powershell-2020.6.0\sessions\PSES-VSCode-18556-120503' -FeatureFlags @() 
24/06/2020 18:12:23 [NORMAL] - powershell.exe started.
24/06/2020 18:12:23 [NORMAL] - Waiting for session file
24/06/2020 18:12:25 [NORMAL] - Session file found
24/06/2020 18:12:25 [NORMAL] - Registering terminal close callback
24/06/2020 18:12:25 [NORMAL] - Registering terminal PID log callback
24/06/2020 18:12:25 [NORMAL] - {"status":"started","languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_bw0u3xdz.c3c","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_k3plnz52.ng3"}
24/06/2020 18:12:25 [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_bw0u3xdz.c3c...
24/06/2020 18:12:25 [NORMAL] - Language service connected.
24/06/2020 18:12:25 [NORMAL] - Language server started.
24/06/2020 18:12:25 [NORMAL] - powershell.exe PID: 24456
24/06/2020 18:13:32 [NORMAL] - powershell.exe terminated or terminal UI was closed

I looked at similar issues too, but found no resolution:
#1673

VS Code version: Code 1.47.2 (17299e413d5590b14ab0340ea477cdd86ff13daf, 2020-07-15T18:22:06.216Z)
OS version: Windows_NT x64 10.0.18363

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2592)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.90GB (18.01GB free)
Process Argv C:\XGit\TestRepo
Screen Reader no
VM 0%
Extensions (12)
Extension Author (truncated) Version
azure-blockchain AzB 1.5.0
terraform has 2.1.1
solidity Jua 0.0.74
vscode-azureterraform ms- 0.3.1
vscode-cosmosdb ms- 0.14.0
vscode-docker ms- 1.4.1
python ms- 2020.7.96456
remote-wsl ms- 0.44.4
azure-account ms- 0.8.11
powershell ms- 2020.6.0
vsliveshare ms- 1.0.2478
vetur oct 0.25.0
@ghost ghost added the Needs: Triage Maintainer attention needed! label Aug 1, 2020
@TylerLeonhardt
Copy link
Member

Are you running as admin by chance?

@devedse
Copy link
Author

devedse commented Aug 4, 2020

@TylerLeonhardt , it fails both when I run it as Administrator and as normal user.

@thenecroscope
Copy link

thenecroscope commented Aug 4, 2020

I've been having this exact same issue on one of my work test servers for a while now and I could never get to the bottom of the issue.

The server in question is a 2012 R2 machine, so quite old.

Everything works fine with Powershell 7.0/7.1, as soon as switch to Powershell 5.1 the system is unable to load the module. I've tried the latest Preview Powershell extension same issue (2020.7.0). The only way I managed to fix this after trying uninstalling, deleting VS cache, trying different versions of VS, trying different user profiles was to downgrade the Powershell extension to 2020.1.0 and now both 5.1 and 7.1 are working for me.

Running as Admin or non admin, same issue.

@rjmholt
Copy link
Contributor

rjmholt commented Aug 4, 2020

as soon as switch to Powershell 5.1 the system is unable to load the module

Is there an error message when it fails? What's the .NET version on the machine?

@SydneyhSmith SydneyhSmith added Needs-Repro-Info and removed Needs: Triage Maintainer attention needed! labels Aug 4, 2020
@thenecroscope
Copy link

thenecroscope commented Aug 5, 2020

Thank you. Details to follow shortly once I'm properly back online.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Aug 5, 2020
@devedse
Copy link
Author

devedse commented Aug 6, 2020

It seems both issues differ a little though since I'm having the issue with the latest PowerShell version too. Do you guys need any additional information to further investigate this? (Or do you want to setup a call?)

@thenecroscope
Copy link

Thanks. At the minute I'm struggling a bit to get access to the server in question. Once I get back online I will try and include some additional information that will help you out. Updates to follow.... Thanks again 👍

@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Aug 11, 2020
@nelswad
Copy link

nelswad commented Aug 12, 2020

I had the same issue where PowerShell 7 works but Windows PowerShell 5.1 did not. I noticed the problem when I realized PSScriptAnalyzer wasn't worked as expected in PS7. Tried to change to WinPS and the prompt never came up.

What fixed the problem for me was opening the folder where my PSScriptAnalyzerSettings.psd1 file was located. Don't think it was completely necessary to open this specific folder, but it cleared the error about having a null or empty workspaceRootPath.

Now both PS7 and WinPS work no problem. Even after closing the folder, I am unable to duplicate the problem.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Aug 12, 2020
@devedse
Copy link
Author

devedse commented Aug 13, 2020

When I start PowerShell in cmd then I'm also at version 5.1:

Name             : ConsoleHost
Version          : 5.1.18362.752
InstanceId       : 421d9d82-64e8-47e3-b92f-2d0120d071f8
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

@SydneyhSmith
Copy link
Collaborator

Thanks everyone this looks like a duplicate of #2719

@SydneyhSmith SydneyhSmith added Resolution-Duplicate Will close automatically. and removed Needs-Repro-Info Needs: Maintainer Attention Maintainer attention needed! labels Aug 13, 2020
@ghost
Copy link

ghost commented Aug 14, 2020

This issue has been marked as duplicate and has not had any activity for 1 day. It has been closed for housekeeping purposes.

@ghost ghost closed this as completed Aug 14, 2020
@similar-issues-ai similar-issues-ai bot mentioned this issue Apr 13, 2025
6 tasks
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate Will close automatically.
Projects
None yet
Development

No branches or pull requests

6 participants