After a Visual Studio Code update the other day, all the PowerShell scripts refusing to run due to a “Language server startup failed”. Both reinstalling Visual Studio Code and PowerShell extension didn’t do anything to fix it.
And guess what to blame, the Digital Certificate, because it’s not trusted. Thanks to this thread on Github.
Here is how to fix it:
Navigate to the following location:
Right-click the file Start-EditorServices.ps1 and choose Properties.
Switch to Digital Signatures tab, highlight the digital certificate listed in there and click Details.
Click View Certificate, go to the Details tab on the dialog box that pops up.
Click Copy to File…, follow the wizard to save a file with .CER extension.
Now, open the Certificate MMC and import the saved .CER certificate file into the Trusted Publishers Certificate Store, either in the User account or Local Machine.
Re-open Visual Studio Code and you should be able to run any PowerShell scripts by now.