Microsoft is no longer actively developing the PowerShell Integrated Scripting Environment (ISE). In this tutorial, you'll quickly get up to speed with using Visual Studio Code in many of the same ways you used the ISE.

You may have heard the news that Microsoft is no longer actively developing the PowerShell Integrated Scripting Environment (ISE). This means we Windows systems administrators need a new PowerShell code editor, and for most people, that road leads to the free, cross-platform, open-source Visual Studio Code (VSCode). Yes, "open source" means you can actually contribute to the VSCode code base if you are so inclined.

Today I'm going to teach you to configure VSCode so it behaves largely like the ISE. Honestly, I've found after much resistance that VSCode offers much more customizability (and a better debugger) than the ISE, so I'm happy I finally made the switch.

Install VSCode ^

Go ahead and install the latest VSCode release in any way you're most comfortable with. I suggest you also install Git so you can take advantage of VSCode's built-in Git version control support.

Note: For production environments, I suggest you use stable releases and not the Insiders edition. As it is, the VSCode development team commits stable releases at least twice a month, so you can expect frequent changes and fast bug fixes. Also, you can now install the software without administrative elevation.

Another tip I have for you is to include VSCode to your system's PATH environment variable. This will allow you to launch VSCode by typing Code from the Run dialog box or console prompt.

Include VSCode in your PATH environment variable

Include VSCode in your PATH environment variable

After installation, open the Run dialog box and type code script.ps1. You should observe that Visual Studio opens and creates a new file named script.ps1. At this point, Visual Studio code doesn't have PowerShell intelligence. However, we are going to fix that problem right now.

Install key extensions ^

Click the Extensions icon in the VSCode Activity Bar and type powershell to search the Visual Studio Marketplace. The Activity Bar and the various Side Bar panes are reminiscent of the ISE Add-ons pane.

Select Microsoft's PowerShell extension and then click Install. This extension unlocks PowerShell language support in VSCode, including IntelliSense code completion and a rich debugger. Click Reload to refresh your VSCode session after extension installation.

You will find that VSCode extensions update themselves periodically and that most extension authors work on a DevOps continuous integration software development lifecycle. This is twenty-first century IT after all!

Install the PowerShell VSCode extension

Install the PowerShell VSCode extension

We now have the PowerShell integrated console and full PowerShell support. Go ahead and type some PowerShell code in your script.ps1 file and test it out! By the way, save your script.ps1 test file to disk so we can continue using it throughout this tutorial. Let me walk you through the following annotated screenshot:

PowerShell support in VSCode

PowerShell support in VSCode

  1. A: Use the Tab and arrow keys to navigate IntelliSense
  2. B: Press F8 to run the current code line in the integrated Terminal; select Terminal > Run Active File to run the entire script file
  3. C: Access PowerShell extension options
  4. D: Change the PowerShell engine VSCode uses (yes, this works with PowerShell Core!)

Configure PowerShell settings ^

The Command Palette is the primary navigational/configuration tool in VSCode. Select View > Command Palette or press Ctrl+Shift+P, type configure, arrow down to Configure 'PowerShell' language based settings, and press Enter. As I mentioned previously, you can also click the PowerShell status bar entry to bring up the PowerShell extension options.

Note: The status bar displays the language VSCode identifies in your source code. For PowerShell script and module files, the PowerShell extension should display accordingly.

VSCode has a new user interface for navigating settings. As you can see in the following screenshot, PowerShell-specific editor settings are under Extension > PowerShell Config..., and you can find general editor settings under Commonly used.

Configuring VSCode settings

Configuring VSCode settings

We don't have the space to describe every setting, but I will link you to the VSCode settings reference and share some of my preferred editor/PowerShell settings:


"editor.mouseWheelZoom": true,
    "editor.minimap.enabled": false,
    "editor.renderWhitespace": "all",
    "editor.renderControlCharacters": true,
    "editor.wordWrap": "on",
    "editor.formatOnType": true,
    "editor.formatOnPaste": true,
    "files.trimTrailingWhitespace": true,
    "files.autoSave": "afterDelay",
    "powershell.enableProfileLoading": true,
    "powershell.integratedConsole.focusConsoleOnExecute": true,
    "powershell.integratedConsole.showOnStartup": false,
    "terminal.integrated.fontFamily": "Consolas",
    "terminal.integrated.fontSize": 18,
    "terminal.integrated.lineHeight": 1,
    "": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "powershell.powerShellExePath": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "files.associations": {"*.ps1": "powershell"}

If you want to work with the raw settings.json user settings file, open the Command Palette and type Preferences: Open Settings (JSON).

NOTE: All your VSCode settings files are stored in the path %UserProfile%\AppData\Roaming\Code\User.

Change the theme and add icons ^

Microsoft packages the ISE color theme with the PowerShell extension. In the Command Palette, type theme to reach Preferences: Color Theme and then select PowerShell ISE from the list. Arrow up and down through the list of installed themes to test them out; press Enter to commit your change. Use the Extensions sidebar to search for more light and dark themes at your leisure.

PowerShell ISE color theme

I also suggest you install an icon pack to make your files look more meaningful. This step is always optional and perhaps a bit less important now that the ISE theme includes some basic icons. Three popular third-party icon packs are:

  1. vscode-icons
  2. VSCode Great Icons
  3. Material Icon Theme

Below you can see the difference between the default VSCode icon view (left) and the Material Icon Theme view (right).

VSCode custom file icons

VSCode custom file icons

By the way, until you get the hang of the Command Palette, try the gear icon in the lower left corner of the interface. You can get to the icon option here too.

VSCode settings menu

VSCode settings menu

Install PowerShell snippets ^

Pre-built code snippets were one of my favorite PowerShell ISE features. Here's how you can add some nifty PowerShell code starters to VSCode:

  1. Copy the contents of Keith Hill's PowerShell snippets file from his GitHub repository.
  2. In the VSCode Command Palette, type snippet, then Preferences: Configure User Snippets, and then PowerShell.
  3. Paste Keith's snippets over the boilerplate content in the json config file.

As you can see in the next screenshot, AutoComplete and IntelliSense will show you snippet triggers as you type. Alternatively, you can use the Command Palette and type insert snippet.

Using snippets in VSCode

Using snippets in VSCode

Next steps ^

I hope you feel a bit more comfortable using Visual Studio Code. As I stated earlier, I resisted moving away from the ISE because it's been such a faithful tool to me over the years. However, the excellent, helpful community surrounding VSCode helped me to overcome my learning curve and enjoy using the tool to create and maintain my PowerShell code.

Let me leave you with some additional tutorial and reference links for your studying pleasure:

Subscribe to 4sysops newsletter!