$PSVersionTable: PS C:\Users\q794776> $PSVersionTable
Name Value
---- -----
PSVersion 5.0.10586.117
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.10586.117
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:
PowerShell Integrated Console does not work.....
code -v
$pseditor.EditorServicesVersion
code --list-extensions --show-versions
$PSVersionTable
Terminal does not work. It worked before I performed the VScode upgrade which was done today.
10/9/2017 3:28:03 PM [NORMAL] - Visual Studio Code v1.17.0 64-bit
10/9/2017 3:28:03 PM [NORMAL] - PowerShell Extension v1.4.3
10/9/2017 3:28:03 PM [NORMAL] - Operating System: Windows 64-bit
10/9/2017 3:28:03 PM [NORMAL] - Language server starting --
10/9/2017 3:28:03 PM [NORMAL] - exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0powershell.exe
10/9/2017 3:28:03 PM [NORMAL] - args: C:\Users\q794776.vscode\extensions\ms-vscode.powershell-1.4.3\scripts\Start-EditorServices.ps1 -EditorServicesVersion '1.4.1' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.4.3' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\q794776.vscode\extensions\ms-vscode.powershell-1.4.3\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\q794776.vscode\extensions\ms-vscode.powershell-1.4.3\logs\1507577283-8fc44e83-a80e-4a7f-bcf2-67761b34ccaf1507577267715\EditorServices.log' -SessionDetailsPath 'C:\Users\q794776.vscode\extensions\ms-vscode.powershell-1.4.3\sessions\PSES-VSCode-4180-886972' -FeatureFlags @()
10/9/2017 3:28:03 PM [NORMAL] - powershell.exe started, pid: 9620
10/9/2017 3:29:03 PM [NORMAL] - Language server startup failed.
10/9/2017 3:29:03 PM [ERROR] - The language service could not be started:
10/9/2017 3:29:03 PM [ERROR] - Timed out waiting for session file to appear.
I reinstalled Visual Studio Code, and re-installed the PowerShell plugin and now the terminal loads but it takes a long time to load. I did not time it but it seemed to take about 90+ seconds.
Hey Chad, has the situation improved for you with VS Code 1.17.2? I believe there was a performance issue with the Integrated Terminal that might have been causing this.
Hello, I am having the same issue.
11/13/2017 9:33:29 AM [NORMAL] - Visual Studio Code v1.19.0-insider 64-bit
11/13/2017 9:33:29 AM [NORMAL] - PowerShell Extension v1.5.0
11/13/2017 9:33:29 AM [NORMAL] - Operating System: Windows 64-bit
11/13/2017 9:33:29 AM [NORMAL] - Language server starting --
11/13/2017 9:33:29 AM [NORMAL] - exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
11/13/2017 9:33:29 AM [NORMAL] - args: C:\src\ProgramFiles\VSCode\.vscode\extensions\ms-vscode.powershell-1.5.0\scripts\Start-EditorServices.ps1 -EditorServicesVersion '1.5.0' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.5.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\src\ProgramFiles\VSCode\.vscode\extensions\ms-vscode.powershell-1.5.0\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\src\ProgramFiles\VSCode\.vscode\extensions\ms-vscode.powershell-1.5.0\logs\1510583609-3cd56bc6-8615-4cee-8a94-bb3b2a2e661d1510583606672\EditorServices.log' -SessionDetailsPath 'C:\src\ProgramFiles\VSCode\.vscode\extensions\ms-vscode.powershell-1.5.0\sessions\PSES-VSCode-4628-572597' -FeatureFlags @()
11/13/2017 9:34:29 AM [NORMAL] - Language server startup failed.
11/13/2017 9:34:29 AM [ERROR] - The language service could not be started:
11/13/2017 9:34:29 AM [ERROR] - Timed out waiting for session file to appear.
I tried running Start-EditorServices myself to see a more verbose version of what was happening: I ran C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe C:\src\ProgramFiles\VSCode\.vscode\extensions\ms-vscode.powershell-1.5.0\scripts\Start-EditorServices.ps1 -EditorServicesVersion '1.5.0' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.5.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\src\ProgramFiles\VSCode\.vscode\extensions\ms-vscode.powershell-1.5.0\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\src\ProgramFiles\VSCode\.vscode\extensions\ms-vscode.powershell-1.5.0\logs\1510583609-3cd56bc6-8615-4cee-8a94-bb3b2a2e661d1510583606672\EditorServices.log' -SessionDetailsPath 'C:\src\ProgramFiles\VSCode\.vscode\extensions\ms-vscode.powershell-1.5.0\sessions\PSES-VSCode-4628-572597' -FeatureFlags @()
I got: Missing an argument for parameter 'FeatureFlags'. Specify
a parameter of type 'System.String[]' and try again.
Interestingly enough, it works fine when running VSCode as an Administrator.
I can confirm the bug exists on both Stable 1.18.0 and Insiders 1.19.0
I am seeing the same thing.
12/8/2017 8:40:31 AM [NORMAL] - Visual Studio Code v1.18.1 64-bit
12/8/2017 8:40:31 AM [NORMAL] - PowerShell Extension v1.5.1
12/8/2017 8:40:31 AM [NORMAL] - Operating System: Windows 64-bit
12/8/2017 8:40:31 AM [NORMAL] - Language server starting --
12/8/2017 8:40:31 AM [NORMAL] - exe: C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe
12/8/2017 8:40:31 AM [NORMAL] - args: C:\Users\jcoryat.vscode\extensions\ms-vscode.powershell-1.5.1\scriptsStart-EditorServices.ps1 -EditorServicesVersion '1.5.1' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\jcoryat.vscode\extensions\ms-vscode.powershell-1.5.1\modules' -EnableConsoleRepl -WaitForDebugger -LogLevel 'Normal' -LogPath 'C:\Users\jcoryat.vscode\extensions\ms-vscode.powershell-1.5.1\logs\1512747631-528dcf93-d895-4dfe-afe3-f244164a48f81512747623009\EditorServices.log' -SessionDetailsPath 'C:\Users\jcoryat.vscode\extensions\ms-vscode.powershell-1.5.1\sessions\PSES-VSCode-16108-589881' -FeatureFlags @()
12/8/2017 8:40:31 AM [NORMAL] - powershell.exe started, pid: 10856
12/8/2017 8:41:31 AM [NORMAL] - Language server startup failed.
12/8/2017 8:41:31 AM [ERROR] - The language service could not be started:
12/8/2017 8:41:31 AM [ERROR] - Timed out waiting for session file to appear.
In the log it also shows that it downloads omnisharp every time I try to run a powershell script. At the end it will show a message at the top of the editor "Cannot read property 'length' of undefined"
I overrode the following settings:
"powershell.powerShellExePath": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\Powershell.exe",
"powershell.developer.editorServicesWaitForDebugger": true,
"omnisharp.path": "c:\\omnisharp-win-x64-1.26.\\OmniSharp.exe",
"omnisharp.waitForDebugger": true,
@jcoryatjr You do not want the following setting set to true unless you are debugging the PowerShell Editor Services DLL itself:
"powershell.developer.editorServicesWaitForDebugger": true,
This setting, when set to true, triggers a debug break in the DLL startup code in which the start up waits until you attach a C# debugger - which is perhaps why it is attempting to download/start OmniSharp.
Regression in 2018-01-30 Insiders:
Version 1.20.0-insider
Commit eed7e193125f3d4cfebe2089d1b2a9c674388754
Date 2018-01-30T09:51:29.494Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64
1/30/2018 8:04:58 AM [NORMAL] - Visual Studio Code v1.20.0-insider 64-bit
1/30/2018 8:04:58 AM [NORMAL] - PowerShell Extension v1.5.1
1/30/2018 8:04:58 AM [NORMAL] - Operating System: Windows 64-bit
1/30/2018 8:04:58 AM [NORMAL] - powershell.exe terminated or terminal UI was closed
1/30/2018 8:05:58 AM [NORMAL] - Language server startup failed.
1/30/2018 8:05:58 AM [ERROR] - The language service could not be started:
1/30/2018 8:05:58 AM [ERROR] - Timed out waiting for session file to appear.
@tmknight (or anyone with this issue) can you enable verbose logging and attach the logs here?
Here are instructions:
https://github.com/PowerShell/vscode-powershell/#2-capture-verbose-logs-and-send-them-to-us
@tmknight looks like the integrated terminal in VSCode (insiders) isn't working at all in today's daily build.
With the PowerShell extension disabled, if you open the integrated terminal like so:

The terminal flashes open and disappears.
This would explain why we are seeing the error you are getting.
My recommendation:
The issue opened on them for this is here: https://github.com/Microsoft/vscode/issues/42516
.... and they already have a fix committed 馃帀
To @jcoryatjr, @legendaryleo7, and @phunkodelic. Are you folks still experiencing this issue on stable (or any insider build before today)?
@tylerl0706
RE: PS Terminal. Yes, I observed that with Integrated and Native
RE: Stable - Agreed. I keep both installed.
Let me know if you need additional info - though I see Insiders has been updated and the issue is resolved.
Cheers
@tylerl0706
I had this problem as far back as 2017-11-13. My integrated terminal stays open but stays stuck at a blank screen. I never get a prompt.
Here's the logs from Stable - 2018-01-25:
1517364087-05661b6c-5d4b-4b3b-be4e-5c550c0e6d391517364064920.zip
And Insiders - 2018-01-30
1517365011-bc4b9cc9-dd9f-4ce6-9a02-39f2c88141c31517364997824.zip
I've noticed that there seems to be no issue when running with elevated permissions. I use a standard account and elevate when updating/installing stuff with an admin account. I wonder if that's related to it (in my case at least). I'm using other terminal emulators like ConEmu and Cmder with no problem.
I have also the same issue. Here is the log.
2018-2-13 11:06:32 [NORMAL] - Visual Studio Code v1.20.0 64-bit
2018-2-13 11:06:32 [NORMAL] - PowerShell Extension v1.5.1
2018-2-13 11:06:32 [NORMAL] - Operating System: Windows 10 64-bit
2018-2-13 11:06:32 [NORMAL] - Language server starting --
2018-2-13 11:06:32 [NORMAL] - exe: C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe
2018-2-13 11:06:32 [NORMAL] - args: C:\Users\login\.vscode\extensions\ms-vscode.powershell-1.5.1\scripts\Start-EditorServices.ps1 -EditorServicesVersion '1.5.1' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\login\.vscode\extensions\ms-vscode.powershell-1.5.1\modules' -EnableConsoleRepl -LogLevel 'Verbose' -LogPath 'C:\Users\login\.vscode\extensions\ms-vscode.powershell-1.5.1\logs\1518516392-f346670a-6685-430d-9237-d544e91ce2811518516374265\EditorServices.log' -SessionDetailsPath 'C:\Users\login\.vscode\extensions\ms-vscode.powershell-1.5.1\sessions\PSES-VSCode-1344-985088' -FeatureFlags @()
2018-2-13 11:07:38 [NORMAL] - Language server startup failed.
2018-2-13 11:07:38 [ERROR] - The language service could not be started:
2018-2-13 11:07:38 [ERROR] - Timed out waiting for session file to appear.
I've enable the loging to verbose, but nothing more is added to the logfile. And the file EditorServices.log is not created...I'm running vscode without administrator rights.
Any ideas? Thank you.
I can confirm, I am having the same problem with VSCode 1.19.2 and PowerShell extension 1.5.1. No integrated terminal will open, powershell or otherwise unless I run the program with elevated credentials. Logs are the same as what everyone else is seeing, but have been pasted in below.
2/13/2018 8:13:36 PM [NORMAL] - Visual Studio Code v1.19.2 64-bit
2/13/2018 8:13:36 PM [NORMAL] - PowerShell Extension v1.5.1
2/13/2018 8:13:36 PM [NORMAL] - Operating System: Windows 64-bit
2/13/2018 8:13:36 PM [NORMAL] - Path specified by 'powerShellExePath' setting - '' - not found, reverting to default PowerShell path.
2/13/2018 8:13:36 PM [NORMAL] - Language server starting --
2/13/2018 8:13:36 PM [NORMAL] - exe: C:\Windows\System32\WindowsPowerShell\v1.0powershell.exe
2/13/2018 8:13:36 PM [NORMAL] - args: C:\Users\
2/13/2018 8:14:36 PM [NORMAL] - Language server startup failed.
2/13/2018 8:14:36 PM [ERROR] - The language service could not be started:
2/13/2018 8:14:36 PM [ERROR] - Timed out waiting for session file to appear.
Is there an EditorServices.log file at this location: 'C:\Users\<user>\.vscode\extensions\ms-vscode.powershell-1.5.1\logs\1518570816-9847f26b-3ab2-4368-a1f3-a9c76d0125911518570813582\EditorServices.log'. If so, could you post the contents here if short. If long, please zip and attach. Thanks.
There isn't an EditorServices.log file in the folder, only a vscode-powershell.log file (note directory changed due to new run, but same log output)

OK, well that is consistent with the PSES module not getting far enough along to even create the log file.
It looks like you redacted your username for the log output but this piece remains: C:\Users\bryan.maynard.vscode\.... Is that exactly what was in the log file? I suspect that should be C:\Users\bryan.maynard\.vscode\... with the \ between user name and the .vscode dir. Assuming that was just a mistake in the redaction, can you try executing this from a PowerShell prompt:
C:\Users\bryan.maynard\.vscode\extensions\ms-vscode.powershell-1.5.1\scripts\Start-EditorServices.ps1 -EditorServicesVersion '1.5.1' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\bryan.maynard\.vscode\extensions\ms-vscode.powershell-1.5.1\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\bryan.maynard\.vscode\extensions\ms-vscode.powershell-1.5.1\logs\1518570816-9847f26b-3ab2-4368-a1f3-a9c76d0125911518570813582\EditorServices.log' -SessionDetailsPath 'C:\Users\bryan.maynard\.vscode\extensions\ms-vscode.powershell-1.5.1\sessions\PSES-VSCode-2268-296277' -FeatureFlags @()
Is there any error message output?
You are correct, it was a missed/error redaction...anywho, when I run the command you gave me in a PS window, it goes to PowerShell Integrated Console, and then nothing else happens.
So in this case, there is an EditorServices.log file in the C:\Users\bryan.maynard\.vscode\extensions\ms-vscode.powershell-1.5.1\logs\1518570816-9847f26b-3ab2-4368-a1f3-a9c76d0125911518570813582 dir? Trying to ascertain that PSES started up correctly. If so, then that points to something going wrong when trying to attach this console to a terminal window in VSCode.
Yes, pasted below
2/13/2018 8:31:46 PM [NORMAL] - Method "StartLogging" at line 144 of C:projectspowershelleditorservices\src\PowerShellEditorServices.Host\EditorServicesHost.cs
PowerShell Editor Services Host v1.5.1.0 starting (pid 3312)...
Host application details:
Name: Visual Studio Code Host
ProfileId: Microsoft.VSCode
Version: 1.5.1
Arch: 64-bit
Operating system details:
Version: Microsoft Windows NT 10.0.16299.0
Arch: 64-bit
2/13/2018 8:31:46 PM [NORMAL] - Method "StartLanguageService" at line 180 of C:projectspowershelleditorservices\src\PowerShellEditorServices.Host\EditorServicesHost.cs
Language service started, listening on port 21129
2/13/2018 8:31:47 PM [NORMAL] - Method "StartDebugService" at line 254 of C:projectspowershelleditorservices\src\PowerShellEditorServices.Host\EditorServicesHost.cs
Debug service started, listening on port 13186
OK, so the PSES module starts up correctly but something seems to go wrong in trying to attach it to the VSCode terminal window. Do you have any special integrated terminal settings set in your user (or workspace) settings?
I don't, it's a fresh installation
Hmm...
Is there any difference if you execute this (was missing some PowerShell.exe params):
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "& 'C:\Users\bryan.maynard\.vscode\extensions\ms-vscode.powershell-1.5.1\scripts\Start-EditorServices.ps1' -EditorServicesVersion '1.5.1' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\bryan.maynard\.vscode\extensions\ms-vscode.powershell-1.5.1\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\bryan.maynard\.vscode\extensions\ms-vscode.powershell-1.5.1\logs\1518570816-9847f26b-3ab2-4368-a1f3-a9c76d0125911518570813582\EditorServices.log' -SessionDetailsPath 'C:\Users\bryan.maynard\.vscode\extensions\ms-vscode.powershell-1.5.1\sessions\PSES-VSCode-2268-296277' -FeatureFlags @()"
Unfortunately, no, the console goes to the same integrated console message with the same output in the EditorServices log...this really makes no sense. Makes me believe it's some type of security control that is in place on my work laptop.
AFAICT that is exactly the exe & args passed to the VSCode API that creates the terminal (starts PSES) e.g.
this.consoleTerminal =
vscode.window.createTerminal(
this.title,
powerShellExePath,
powerShellArgs);
Can you try an experiment? Start task manager, go to the Details pane and sort by Name and then find the PowerShell processes and select one (to keep window from scrolling). Now start a debug session in VSCode and see if a new PowerShell appears in the list. It might not run for long. You might want to set the task manager View -> Update speed to High to increase the chances of seeing PowerShell.exe spin up. If this doesn't work, there is a WMI event that will fire whenever a new process starts but I don't remember the syntax for that command off the top of my head.
So, I did do this, and I briefly saw another powershell process spawn, then die. This happened about 4 times before VSCode timed out trying to load the engine.
Thanks for checking that. Can you check your event log (both Applications and WindowsPowerShell) to see if there are any clues as to why the PowerShell process exited early:

I'm not seeing anything in either log pertaining to the problem. I appreciate all the help, but at this point I think I'm simply better off using the PS ISE
Totally understand. Thanks for all your help.
@bjmaynard01 (or anyone game for this experiment) Could you try one more thing for me? I have fixed a bug related to testing for socket ports in use. Can you grab this file - https://raw.githubusercontent.com/PowerShell/vscode-powershell/b25e1abe5d0c9539f0f06e025089bf2c0a504ab0/scripts/Start-EditorServices.ps1 and use its contents to completely replace the contents of $Home\.vscode\extensions\ms-vscode.powershell-1.5.1\scripts\Start-EditorServices.ps1. Now try again. If the console still fails to start at least there should be a Start-EditorServices.log file in the logs dir for the session. Could you paste the contents here? Thanks!!
I'm having the same issue, only in the 1.20.1 release; everything was fine in 1.20. I tried your replacement script, and I'm not seeing the log file; however, instead of just closing the terminal, VS Code is now displaying the below:
An error occurred while starting PowerShell Editor Services:
AuthorizationManager check failed.
at System.Management.Automation.AuthorizationManager.ShouldRunInternal(CommandInfo commandInfo, CommandOrigin origin, PSHost host)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.GetScriptInfoForFile(String fileName, String& scriptName, Boolean checkExecutionPolicy)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(PSModuleInfo parentModule, String fileName, String moduleBase, String prefix, SessionState ss, Object privateData, ImportModuleOptions& options, ManifestProcessingFlags manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleNamedInManifest(PSModuleInfo parentModule, ModuleSpecification moduleSpecification, String moduleBase, Boolean searchModulePath, String prefix, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, Boolean loadTypesFiles, Boolean loadFormatFiles, Object privateData, Boolean& found, String shortModuleName, Nullable1 manifestLanguageMode)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(String moduleManifestPath, ExternalScriptInfo manifestScriptInfo, Hashtable data, Hashtable localizedData, ManifestProcessingFlags manifestProcessingFlags, Version minimumVersion, Version maximumVersion, Version requiredVersion, Nullable1 requiredModuleGuid, ImportModuleOptions& options, Boolean& containedErrors)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(PSModuleInfo parentModule, String fileName, String moduleBase, String prefix, SessionState ss, Object privateData, ImportModuleOptions& options, ManifestProcessingFlags manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadUsingExtensions(PSModuleInfo parentModule, String moduleName, String fileBaseName, String extension, String moduleBase, String prefix, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadUsingModulePath(PSModuleInfo parentModule, Boolean found, IEnumerable1 modulePath, String name, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, PSModuleInfo& module)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName(ImportModuleOptions importModuleOptions, String name)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available.
at Microsoft.PowerShell.ConsoleHostUserInterface.HandleThrowOnReadAndPrompt()
at Microsoft.PowerShell.ConsoleHostUserInterface.PromptForChoice(String caption, String message, Collection1 choices, Int32 defaultChoice)
at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice)
at Microsoft.PowerShell.PSAuthorizationManager.AuthenticodePrompt(String path, Signature signature, PSHost host)
at Microsoft.PowerShell.PSAuthorizationManager.SetPolicyFromAuthenticodePrompt(String path, PSHost host, Exception& reason, Signature signature)
at Microsoft.PowerShell.PSAuthorizationManager.CheckPolicy(ExternalScriptInfo script, PSHost host, Exception& reason)
at Microsoft.PowerShell.PSAuthorizationManager.ShouldRun(CommandInfo commandInfo, CommandOrigin origin, PSHost host, Exception& reason)
at System.Management.Automation.AuthorizationManager.ShouldRunInternal(CommandInfo commandInfo, CommandOrigin origin, PSHost host)
Hope this helps track down this issue!
Looks like the script can't run because I stripped out the authenticode signature. Crud. Looks like we will have to wait until 1.6.0 drops in order to get log file info from Start-EditorServices.ps1. Thanks for giving it a go!
You're welcome. Any ETA on 1.6.0, or should I revert to VS Code 1.20?
Thank you!
We're shooting for early next week. Crossing my fingers.
I did solve my problem. It was with a couple of links I had created in my modules folder. The links pointed to a location that no longer existed and defaulted to C:. Once I removed them, everything started working as it should. Now really loving the powershell in VSCode!
Installed 1.6.0, same issue. I checked, and did not see a Start-EditorServices.log in the logs directory.
However, that being said, I had a thought. This issue seems to have cropped up for me after a policy change to force AllSigned for the powershell execution policy. I was able to revert the change back to RemoteSigned, and everything loads correctly now. As soon as I go back to AllSigned, the terminal fails to start. Wondering if others who are having this issue are also using AllSigned as their execution policy. Hopefully this helps track down and fix the issue!
@Ryoken0367 Interesting. It sure would be nice to figure out which script is failing when the policy is set to AllSigned. When we invoke the script, we start a powershell process with the param -ExecutionPolicy Bypass. That "should" bypass the execution policy.
Can you open your User settings and the following setting:
"powershell.developer.editorServicesLogLevel": "Diagnostic",
If you already have that setting, just make sure that it is set to Diagnostic. We only create the Start-EditorServices.log file when logging is set to Diagnostic. After setting it, restart VSCode and then see if there's a Start-EditorServices.log file. I'm curious if there are any clues in this log file when you have the policy set to AllSigned.
I changed that setting, it was set to Normal; but I'm still not getting the log. Definitely happy to help track this down if you have anything else you need.
Thanks! Do you see any text appear (however briefly) in the PowerShell Integrated Console terminal? The terminal window should show powershell.exe starting up and I'm guess it chokes on execution policy. If you have a screen capture tool, that might help capture text that appears very briefly. Although I've gotten pretty good at hitting PrintScreen key at the right time. :-)
One other thing to check is the WindowsPowerShell event log:

Anything interesting in the entry that corresponds to the failed attempt to start the editor services?
There was an error flashing up on the Terminal for a brief moment and disappearing; I was able to grab it with PrintScreen:

As for the Event Log; there are 8 entries for that time. I can get screenshots of those too, if you'd like, but here's the first detail from each (oldest first):
Provider "Registry" is Started.
Provider "Alias" is Started.
Provider "Environment" is Started.
Provider "FileSystem" is Started.
Provider "Function" is Started.
Provider "Variable" is Started.
Engine State is changed from None to Available.
Engine State is changed from Available to Stopped.
Edit: Re-read your message, here's a screenshot of the "Available to Stopped" entry.

Interesting, what do you get if you run this command from a PowerShell console:
Get-AuthenticodeSignature ~\.vscode\extensions\ms-vscode.powershell-1.6.0\scripts\Start-EditorServices.ps1
I get:
Directory: C:\Users\hillr\.vscode\extensions\ms-vscode.powershell-1.6.0\scripts
SignerCertificate Status Path
----------------- ------ ----
9ACA9419E53D3C9E56396DD2335FF683A8B0B8F3 Valid Start-EditorServices.ps1
Also, what do you get for this command:
Get-Content -Stream Zone.Identifier ~\.vscode\extensions\ms-vscode.powershell-1.6.0\scripts\Start-EditorServices.ps1
This is curious. Your error says it fails on line 1 char 3. This is line 1:
# PowerShell Editor Services Bootstrapper Script
Char 3 is the start of the text PowerShell but why wouldn't PowerShell see that whole line as a comment?
From the first command I get the same result you do. Valid with the same thumbprint.
Directory: C:\Users\WApgar\.vscode\extensions\ms-vscode.powershell-1.6.0\scripts
SignerCertificate Status Path
----------------- ------ ----
9ACA9419E53D3C9E56396DD2335FF683A8B0B8F3 Valid Start-EditorServices.ps1
From the second command I get an error:
Get-Content : Could not open the alternate data stream 'Zone.Identifier' of the file
'C:\Users\WApgar\.vscode\extensions\ms-vscode.powershell-1.6.0\scripts\Start-EditorServices.ps1'.
At line:1 char:1
+ Get-Content -Stream Zone.Identifier ~\.vscode\extensions\ms-vscode.po ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\WApgar...torServices.ps1:String) [Get-Content], FileNotFoundEx
ception
+ FullyQualifiedErrorId : GetContentReaderFileNotFoundError,Microsoft.PowerShell.Commands.GetContentCommand
If the error mentioned Could not open the alternate data stream 'Zone.Identifier' of the file, that means the file has been "unblocked". OK so we have a valid Authenticode signature on the script and the script is not blocked.
What's your $PSVersionTable info? Also, can you copy/paste the text (or images) of these two event viewer events:
Engine State is changed from None to Available.
Engine State is changed from Available to Stopped.
Thanks again for all your help!
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.16299.248
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.248
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1


You're very welcome, whatever I can do to help get this figured out I will. I've loved using VS Code for writing my scripts and utilities; going back to the ISE is almost painful!
Dang. I don't see anything out of the ordinary in those two events.
Hmm, I wonder if you are running into this (see his own, first comment) about group policy: https://community.spiceworks.com/topic/1451509-mdt-powershell-script-authorizationmanager-check-failed
It seems this is definitely the issue; at least for me. We were pushing out the execution policy through GPO. As a test, I have turned that off, and left my machine set at AllSigned, and it runs just fine. Guess I'll be looking into pushing that out through a registry setting instead moving forward.
Thank you for all the help!
Can confirm, I have run into this problem right after we changed our script execution policy to AllSigned through GPO. So there is no way to bypass (pun intended?) execution policy that has been pushed out through group policy?
Edit: Wait, @rkeithhill, could you please advise me on why do you need to launch the script with Bypass execution policy even though it has valid signature?
@rkeithhill perhaps we're missing something that needs to be signed?
Possibly but I don't have access to a domain to test this on i.e. where I could set that policy to AllSigned. I do all of my PSES/ext work at home where it's just a workgroup setup.
However this statement makes me think there's a bug with PS and/or GroupPolicy:
As a test, I have turned that off, and left my machine set at AllSigned, and it runs just fine
Seems like we have everything signed that needs to be signed otherwise the local AllSigned policy should have failed.
@rkeithhill Any ideas we (I) could test for you?
And if it's a bug is there any way to escalate this up to people who can fix it?
Just want to chime in here, @Rdnaskel if there's something that is suppose to be signed that isn't I can fix that.
It would be helpful if someone could setup (or find) an OU with the mentioned GroupPolicy set (force AllSigned). Then put a computer in that OU and apply the group policy (gpupdate /force). Then create (or find) a signed script and try to run it like so:
powershell.exe -noninteractive -noprofile -executionpolicy bypass -noexit -file <path-to-signed-ps1>
I think the issue is that the above fails because the command line attempt to "bypass" execution policy does not override the group policy setting. This would mean the VSCode extension has no hope of working in this "GP setting AllSigned" case. Perhaps this is a PowerShell and/or GroupPolicy issue or perhaps it is by design?
Sorry for the delay.
@rkeithhill It is strange but the scripts run just fine when I run them manually and signature is correct.
I tried it with two scripts, one of which is just Get-Process, the other one is somewhat more complicated.
When Get-Process is correctly signed it runs just fine both natively from the console and with execution policy Bypass. But just when I've scrambled the signature both ways to run the scripts run into error with "Incorrect hash" (apparently) FullyQualifiedErrorId : UnauthorizedAccess.
Edit: I can also see this behaviour to be by design (please correct me if I'm wrong here) because doesn't it mean that there is essentially a security blackhole in the mere existance of Bypass policy? I'm not sure if everyone is allowed to run powershell with Bypass Execpol but it that's the case I'm not really sure there's any sense in having all those different policies if anyone can just run it like that).
Ran into some information that might be helpful for this.
When AuthorizationManager calls out to SecuritySupport to get the execution policy it iterates scopes until it gets to one that isn't Undefined. The order it iterates is here. Unfortunately both policy scopes come before the Process scope, meaning we have no way of overriding this.
The message from the exception being thrown means an exception was that wasn't expected.
The AuthorizatonManager calls host API's when a file is considered remote. I know the entry script itself doesn't show as remote, but maybe something else does.
My guess is the problem is with the PSES host, it's possible the prompt handlers aren't fully initialized by the time the AuthorizationManager tries to call them. I'm not able to look into this much further than that, but hopefully that helps.
The bigger problem is that even if this is just a host problem, and that gets fixed, using VSCode in all signed would be a pain.
I did not follow the complete discussion about this issue, but I had the same problem.
I fixed it because I noticed a script file was blocked by my Comodo Virusscanner.
Is was placed in a container. The file is named
C:\ProgramData\Comodo\Cis\tempscrpt\C_powershell.exe_EFAEA8F70B368160CB79A10CD78D7AABE655764F.ps1
When this script was trusted the issue was resolved.
Hope this helps.
I've managed to get Visual Studio Code working under AllSigned.
I don't know how it had not struck me earlier but as @rkeithhill said earlier everything that needs to be signed is signed. So we do Get-AuthenticodeSignature<full path>\Start-EditorServices.ps1 | select * and see this
SignerCertificate : [Subject]
CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
[Issuer]
CN=Microsoft Code Signing PCA 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
[Serial Number]
33000000C4E989F87A8150E9FF0000000000C4
[Not Before]
8/11/2017 11:20:24 PM
[Not After]
8/11/2018 11:20:24 PM
[Thumbprint]
9ACA9419E53D3C9E56396DD2335FF683A8B0B8F3
Microsoft Code Signing PCA 2011 is not on my machine's Trusted Root Certification Authorities list.
Googling Microsoft Code Signing PCA 2011 leads me to knowing that this certificate is distributed along with Visual Studio itself and the necessary file is name "manifestSignCertificates.p12".
There's a mention in this guide that one needs to install a number of certificates for Visual Studio offline installation.
This article mentions being able to download Visual Studio installation files doing this vs_community.exe --layout C:\vs2017offline --lang en-US as I hadn't managed to find the certificates anywhere else (maybe they're here on github somewhere).
So I get out this "manifestSignCertificates.p12" and double-click it 'nexting' it to my Trusted Root CAs.
But in order to launch scripts under either RemoteSigned or AllSigned you need to trust both a root CA and a certificate issuer so then when I manually start .\Start-EditorServices.ps1 I still get a warning that Microsoft is not a Trusted Issuer. But! If you hit [A] to always launch scripts signed by that issuer its certifcate gets into Cert:\CurrentUser\TrustedPublisher and the script runs just fine.
So VS Code now works as expected.
And this whole situation leads me to citing myself:
I can also see this behaviour (bypass scripts not working under AllSigned Group Policy setting) to be by design (please correct me if I'm wrong here) because doesn't it mean that there is essentially a security blackhole in the mere existance of Bypass policy? I'm don't know if everyone is allowed to run powershell with Bypass Execpol but it that's the case I'm not really sure there's any sense in having all those different policies if anyone can just run it like that).
Sorry for a bit broken English.
Thanks for the detailed explanation, everyone!
It sounds like we need to take one of two paths:
Did I miss something?
I'am having the same problem with portable VSCode on Terminal Server:
2018-6-7 14:19:35 [NORMAL] - Visual Studio Code v1.23.1 64-bit
2018-6-7 14:19:35 [NORMAL] - PowerShell Extension v1.7.0
2018-6-7 14:19:35 [NORMAL] - Operating System: Windows 64-bit
2018-6-7 14:19:35 [NORMAL] - Language server starting --
2018-6-7 14:19:35 [NORMAL] - exe: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
2018-6-7 14:19:35 [NORMAL] - args: M:\VSCode\vscodeExts\ms-vscode.powershell-1.7.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.7.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'M:\VSCode\vscodeExts\ms-vscode.powershell-1.7.0\modules' -EnableConsoleRepl -LogLevel 'Diagnostic' -LogPath 'M:\VSCode\vscodeExts\ms-vscode.powershell-1.7.0\logs\1528373975-b8616985-9aa0-43d2-a1d2-a3744a6ea6141528373955342\EditorServices.log' -SessionDetailsPath 'M:\VSCode\vscodeExts\ms-vscode.powershell-1.7.0\sessions\PSES-VSCode-153532-119682' -FeatureFlags @()
2018-6-7 14:19:39 [NORMAL] - powershell.exe started, pid: 163164
2018-6-7 14:20:36 [NORMAL] - Language server startup failed.
2018-6-7 14:20:36 [ERROR] - The language service could not be started:
2018-6-7 14:20:36 [ERROR] - Timed out waiting for session file to appear.
Transcript started, output file is M:\VSCode\vscodeExts\ms-vscode.powershell-1.7.0\logs\1528373975-b8616985-9aa0-43d2-a1d2-a3744a6ea6141528373955342\Start-EditorServices.log
VERBOSE:
#-- Updated PSModulePath to: -------------------------------------------------
VERBOSE: M:\Eigene Dateien\WindowsPowerShell\Modules
VERBOSE: C:\Program Files\WindowsPowerShell\Modules
VERBOSE: C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
VERBOSE: C:\Program Files\Citrix\PowerShell Modules\
VERBOSE: M:\VSCode\vscodeExts\ms-vscode.powershell-1.7.0\modules
VERBOSE:
#-- Check required modules available -----------------------------------------
VERBOSE: Testing module availability PowerShellGet
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1'.
VERBOSE: PowerShellGet found
VERBOSE:
#-- Start up PowerShellEditorServices ----------------------------------------
VERBOSE: Importing PowerShellEditorServices
VERBOSE: Loading module from path 'M:\VSCode\vscodeExts\ms-vscode.powershell-1.7.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'.
VERBOSE: Loading module from path 'M:\VSCode\vscodeExts\ms-vscode.powershell-1.7.0\modules\PowerShellEditorServices\PowerShellEditorServices.psm1'.
VERBOSE: Exporting function 'Start-EditorServicesHost'.
VERBOSE: Exporting function 'Compress-LogDir'.
VERBOSE: Exporting function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Compress-LogDir'.
VERBOSE: Importing function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Start-EditorServicesHost'.
VERBOSE: Checking port: 21113, attempts remaining 10 --------------------
VERBOSE: Testing availability of port 21113 at address 127.0.0.1 / InterNetwork
VERBOSE: Port: 21113 is available
VERBOSE: Checking port: 15460, attempts remaining 10 --------------------
VERBOSE: Testing availability of port 15460 at address 127.0.0.1 / InterNetwork
VERBOSE: Port: 15460 is available
PowerShell Integrated Console
VERBOSE: Invoking Start-EditorServicesHost
VERBOSE: Start-EditorServicesHost returned Microsoft.PowerShell.EditorServices.Host.EditorServicesHost
VERBOSE: Writing session file with contents:
VERBOSE: {"debugServicePort":15460,"status":"started","debugServiceTransport":"Tcp","languageServiceTransport":"Tcp","languageServicePort":21113}
VERBOSE: Wrote out session file
VERBOSE:
#-- Waiting for EditorServicesHost to complete execution ---------------------
This works for me:
\ms-vscode.powershell-1.7.0\out\src\utils.js:
innerTryFunc(180, 1000);
Hello, I had the same issue... My company uses an AllSigned GPO as well. I just signed the build script and it looks like it worked...
I think,
...........
Hi @davidm1984, we just did some work on this to make sure the certificates are all correct and up to date with the modules and scripts -- everything is Authenticode signed.
Would you be able to give some more info on the problem you experienced here and what you needed to do to work around it? You mentioned a build script, but do you mean the scripts to build from source? Or something in the released VSIX?
Hi all,
Are people still experiencing this issue?
I did some investigation into our signing about a month ago to get us signed with all the right certs -- want to see if that's solved anything or if we need to do more work here.
Hi @rjmholt,
I just tested this, and it seems to be working just fine now with the GPO set to AllSigned. No issues loading VS Code or the Powershell Extension at all. Intellisense and everything seems to be working as intended. (VS Code 1.28.0 and Powershell extension 1.9.0.)
Thank you for making that happen!
Closing for now -- if the issue recurs, we can reopen
I know this was closed... but the issue seems to have popped up again with version 1.10.2 of the extension. With AllSigned GPO applied the language service fails to start. With Unrestricted it opens and runs just fine. Wondering if PS Editor Services was signed with the wrong cert again before publishing that version?
@Ryoken0367 I want to make sure it's actually a result of the 1.10.2 release. Can you install 1.10.1 or 1.10?
I spoke with @TravisEz13 about this and confirmed that we are indeed signing correctly with the correct certificate.
The problem is that PowerShell trusts no signing certificate out of the box and you need to add the certificate to your trusted cert list yourself. This isn't something we should ever do automatically, but we should ideally ship a script that will do it all when invoked.
Here's an implementation:
# Temp file path to put the cert on
$certPath = Join-Path $env:TEMP powershelleditorservices.cer
# The signature for the EditorServices module file
$sig = Get-AuthenticodeSignature C:\Users\roholt\.vscode\extensions\ms-vscode.powershell*\modules\PowerShellEditorServices\PowerShellEditorServices.psd1
# Export the signing certificate to a file for import
$sig.SignerCertificate.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Cert) > $certPath
# Import the certificate into the machine's cert store
Import-Certificate -FilePath $certPath -CertStoreLocation Cert:\CurrentUser\TrustedPublisher
Reopening to track shipping a script to do this
@Ryoken0367 can you confirm that @rjmholt's script works? Keep in mind, you need to make a small tweak to the path in the example.
Nope, it doesn't work and I'm not sure why he thought it would.
PS C:\Users\mydir> $sig.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Cert) > $certPath
Method invocation failed because [System.Management.Automation.Signature] does not contain a method named 'Export'.
At line:1 char:1
+ $sig.Export([System.Security.Cryptography.X509Certificates.X509Conten ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Nope, it doesn't work and I'm not sure why he thought it would.
Sorry, typo: $sig.Export(...) should be $sig.SignerCertificate.Export(...). I've edited the snippet. Try that.
Also note that this will only work in Windows PowerShell for now, since it depends on the PKI module
Sorry all, been super busy the past couple of days; just getting a chance to circle back around to this. Tested the script (after making the path tweak), and getting an error. It seems the certificate it's creating isn't valid.

When I open the certificate file I get:

I've looked into this a bit more (above script was a naive attempt to turn a GUI procedure into script).
Here's a script that I've verified works on my machine:
# The signature for the EditorServices module file
$cert = (Get-AuthenticodeSignature ~\.vscode\extensions\ms-vscode.powershell*\modules\PowerShellEditorServices\PowerShellEditorServices.psd1).SignerCertificate
# Get the Cert:\CurrentUser\TrustedPublisher cert store
# IMPORTANT: You may not want CurrentUser here -- change to your needed location
$store = [System.Security.Cryptography.X509Certificates.X509Store]::new("TrustedPublisher", "CurrentUser")
# Open the store
$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::MaxAllowed)
# Add the cert to the TrustedPublishers store
$store.Add($cert)
That worked, I left it at CurrentUser, since I'm the only user of this computer. No errors, and the integrated console loads without issue now as well.
After workshopping a good way to trust the MS certificate (the obvious problem being that any PowerShell script to trust the certificate would also be untrusted), it turns out a very simple way is to just interactively import the editor services module and select Always run (verifying that the signing certificate is indeed a Microsoft Corporation one).
So:
ipmo ~/.vscode/ms-vscode.powershell*/modules/PowerShellEditorServices/PowerShellEditorServices.psd1
Then:

@SydneyhSmith we can doc this workaround in https://docs.microsoft.com/en-us/powershell/scripting/components/vscode/using-vscode?view=powershell-6
or somewhere in docs.microsoft.com
It _could_ go in our troubleshooting doc in GitHub, but I feel like this would be better in a slightly more official location
@TylerLeonhardt Yeah I'm thinking it should live in docs, we can decide if it should be a sub category or a doc of its own--adding it to my backlog 馃槃
Closing as this has now been documented https://github.com/MicrosoftDocs/PowerShell-Docs/pull/3612
Most helpful comment
After workshopping a good way to trust the MS certificate (the obvious problem being that any PowerShell script to trust the certificate would also be untrusted), it turns out a very simple way is to just interactively import the editor services module and select
Always run(verifying that the signing certificate is indeed a Microsoft Corporation one).So:
Then:
