Installing Visual Studio Code and the PowerShell Extension

Last week Microsoft released a new version of Visual Studio Code along with an extension for writing PowerShell in it. Visit code.visualstudio.com to download Visual Studio Code. There’s also an update link on that page if you happen to have a version prior to 0.10.1. The PowerShell extension for Visual Studio Code only works with PowerShell version 5. Either Windows 8.1 with the WMF 5 Production Preview installed or Windows 10 is sufficient.

The GUI installation of Visual Studio Code is a clickersize. There’s also a long list of command line options to perform an unattended installation:

.\VSCodeSetup.exe /?

vscode1a.png

This website is listed at the bottom of the following image:

vscode2a.png

I’ll install it from the command line using the Very Silent option:

.\VSCodeSetup.exe /VerySilent

vscode3a.png

vscode4a.png

After the installation finishes, a desktop icon will be created and Visual Studio Code will be launched automatically.

To install the PowerShell extension, from within Visual Studio Code use the key combination Cntl+Shift+P or select View > Command Palette... from the menu options:

vscode5b.png

Backspace over the > and type in ext install powershell and select the first entry:

vscode6a.png

That will download the extension and place it in the .vscode\extensions folder under your user profile:

vscode7a.png

Note: Internet access is required to install the extension otherwise you’ll receive this error:

vscode8a.png

The following message is displayed once the installation is complete and you’ll need to restart Visual Studio Code:

vscode9a.png

The best place to start is by opening up the examples folder in Visual Studio Code. The examples folder is located under your user profile in .vscode\extensions\ms-vscode.PowerShell\examples:

vscode10c.png

Now you’ll be able to write PowerShell in Visual Studio Code:

vscode11a.png

ยต