Using Visual Studio Code Instead of PowerShell ISE

Most directors use the PowerShell ISE (Integrated Scripting Environment) to construct their PowerShell scripts. But by now Microsoft has virtually stopped growing PowerShell ISE and recommends utilizing a extra highly effective, handy, versatile and free device as a substitute — Visual Studio Code (VS Code). In this text, we’ll think about the best way to set up, configure and use Visual Studio Code as a substitute of PowerShell ISE to run your PowerShell instructions in addition to to develop and check advanced PowerShell scripts.

VS Code is a cross-platform improvement setting with so much of extensions you should utilize to create a code virtually on any programming language. VS Code has the built-in Git assist and an unlimited quantity of options to work together with your code and debug it.

You can obtain VSCode without cost following this hyperlink: Download the VSCodeSetup-x64 set up file (about 53MB) and run it.

VSCode set up doesn’t trigger any issues. However, it is strongly recommended so as to add paths to Visual Studio Code to the setting variable PATH through the set up.

install visual studio code

After beginning Visual Studio Code, you’ll have to set up a particular free extension that helps PowerShell language — ms-vscode.PowerShell (

This extension provides you superior choices to work together with your PowerShell code: syntax-highlighting, snippets, computerized command hinting (IntelliSense), built-in assist and cmdlet browser, interactive script debugging, and so forth.

You can set up the extension from the Extension menu within the left sidebar. Search by powershell key and set up the PowerShell extension: Develop PowerShell scripts in Visual Studio Code.

install powershell extension for visual studio code

If you’re working in an remoted setting, you possibly can set up the extension from a VSIX file. Download following the hyperlink above and set up it utilizing the Install from VSIX menu choice.

powershell vsix extension ms-vscode

To make it extra handy, I’ve configured the next VSCode interface settings (a gear icon within the decrease left nook).

workbench.colorTheme = PowerShell ISE – the colour scheme is nearly alike the acquainted one in PowerShell ISE
editor.formatOnType = On
editor.formatOnPaste = On
powershell.integratedConsole.focusConsoleOnExecute = Off
window.zoomLevel = zero
editor.mouseWheelZoom = On

You can even set VSCode settings through JSON file. To do it, click on Open Settings (JSON), then copy and paste these settings as plain textual content right here:

ms vscode - powershellshell ise color theme

VSCode helps so much of shell and programming languages. To change between them, press F1. In the bar that seems kind Change Language mode and choose which language syntax you wish to use. Select PowerShell and the icon of the file opened within the energetic tab will change to the PS one.

vs code - powershell editor

Let’s attempt to use VSCode options to run a PowerShell command and debug scripts.

Create a brand new undertaking file (it’s a widespread textual content file). You can work with a number of recordsdata concurrently, they’re proven as separate tabs as effectively and you’ll change between them.

Type a easy command to show the record of operating processes: Get-Process. As you possibly can see, the IntelliSense technology helps computerized hinting of the command you select by urgent Tab and the built-in assistance on the accessible cmdlet parameters.

powershell cmdlets in visual studio code

In order to execute a single PowerShell command, choose the road you want and press F8. If you wish to run a number of strains of your PowerShell code, choose them together with your mouse within the editor window and press F8. You will see the ends in the Terminal window. To run the entire PS1 script file, choose Terminal -> Run Active File.

In the Terminal window, you can even run PowerShell and cmd.exe instructions within the interactive mode.

powershel terminal in vs code

If you’re utilizing capabilities in your PowerShell code, you’ll go to the perform code once you right-click its title and choose Go to Definition.

vs code powershell function

Using the built-in script debugger (Ctrl+Shift+D) you possibly can see the variable values, reference values and set break factors when operating your PowerShell script.

I hope that this text will develop into an excellent place to start out studying and utilizing wealthy options of Visual Studio Code to develop your PowerShell scripts.

Check Also

How to Restore Deleted EFI System Partition in Windows 10?

In this text we’ll present you ways to manually restore an by chance deleted Windows …

Leave a Reply

Your email address will not be published. Required fields are marked *