PowerShell editors
While it is possible to write for PowerShell using the Notepad application alone, it is rarely desirable. Using an editor designed to work with PowerShell can save a lot of time.
Specialized PowerShell editors, at a minimum, offer automatic completion (IntelliSense) that reduces the amount of cross-referencing required while writing code. Finding a comfortable editor early is a good way to ease into PowerShell: memorizing commands and parameters is not necessary.
Two editors are discussed, as follows:
- PowerShell ISE
- Visual Studio Code
PowerShell ISE
PowerShell IntegratedScriptingEnvironment (ISE) was introduced with PowerShell 2 in October 2009 and has been updated with every subsequent release.
ISE has an immediate advantage over other editors. It is installed along with PowerShell itself and is likely to be available in some form wherever PowerShell is. ISE consists of a text editor pane and a script pane, as shown in the following screenshot:

Features
ISE is a rich editing environment that includes IntelliSense, built-in help, syntax checking, debugging, and so on.
Additional features are available for ISE from the following add-on tools website:
If you are developing code for use on production systems, I strongly recommend adding PS Script Analyzer. PS Script Analyzer will highlight areas of your code that do not conform to its rule set; for example, using an alias instead of a command name would be highlighted.
Community and commercial add-ons can greatly extend the functionality of ISE to simplify day-to-day use.
Installing ISE Preview
In PowerShell 5, the distribution model for ISE is in the process of changing. Until version 5, ISE was released as a part of the Windows Management Framework (WMF). New features were introduced with each version of WMF, but the time between the versions was long.
ISE Preview may be installed from the PowerShell gallery using the following command:
Install-Module -Name PowerShellISE-Preview
Once installed, the update-module
command may be used to bring ISE up to par with the published version.
ISE Preview can coexist with the version of ISE installed by the WMF package.
Starting ISE
ISE may be started from the start menu; however, running the powershell_ise
command (from the Run
dialog, cmd
, or the search box) is sufficient. In PowerShell, the simpler ise
command is aliased to powershell_ise.exe
.
If the preview version from the PowerShell gallery is being used, the following command will start that version of ISE:
Start-ISEPreview
This first preview version differs a little from the version of ISE shipping with WMF 5. If the distribution model is successful, the PowerShell team hopes to release a new version of ISE every month, with each release fixing bugs and/or adding new features.
Visual Studio Code
Visual Studio Code is a free open source editor published by Microsoft. VS Code may be downloaded from http://code.visualstudio.com.
VS Code is a good choice of editor when working with multiple languages or when specifically looking for an editor that supports Git in a simple manner.
Features
VS Code does not come with the native PowerShell support. It must be added. Once VS Code is installed, open it, and select the EXTENSIONS
button on the left-hand side.
Type PowerShell
in the search dialog box, and install the PowerShell language support:

After installation, the extension provides Syntax highlighting
, testing using PowerShell Script Analyzer
, debugging, and so on.
Console
Unlike ISE, the console (or terminal, as it is named) in VS Code must be configured. By default, the terminal in code uses cmd.exe
.
The following process is used to make the terminal use PowerShell:

- Open
User
Settings
fromFile
and
Preferences
. The same may be achieved by pressing F1 and typinguser settings
followed by return. - This opens two windows: a
Default Settings
file on the left and asettings.json
on the right. The file on the right holds user-specific configuration that overrides or adds to the default. - Expand the
Integrated Terminal
section inDefault Settings
(by clicking on theo9
symbol) to show the default values. - On the right-hand side, enter the following between the curly braces:
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
- Save the changes, then press Ctrl+Shift+' (apostrophe) to open a new PowerShell terminal. Ctrl + ' (apostrophe) toggles the visibility of the terminal window.
Note
This is not ISE
In PowerShell ISE, F5 + F8 may be used to execute a script. This is not the case in VS Code. A selection may be executed by pressing F1 and typing run selected
to filter options to Terminal: Run Selected Text in Active Terminal
.
Version control (Git)
Visual Studio Code comes with integrated support for Git version control. Git is a distributed version control system; each developer has a copy of the same repository.
Setting up a repository is simple, as follows:
- Open a folder that contains a project. Then, select the
Git
button (or press Ctrl +Shift +G). - Click on
Initialize git repository
button as shown in the following screenshot:

- Once you have done this, files may be added to version control when committing (applying a change).
Subsequent changes to files may be inspected before committing again:
