Working with the VSCode PowerShell extension
Administrators have a choice of multiple scripting tools, but the VSCode PowerShell extension could sway IT pros to a relatively new code editor.
In the early years of Windows PowerShell, there were several editors to use with the language, with the Integrated Scripting Environment (ISE) being perhaps the most popular. ISE is a built-in tool on Windows designed for use with PowerShell scripts. Microsoft no longer develops ISE in favor of Visual Studio Code (VSCode), which runs on platforms other than Windows. VSCode, officially released in 2016, is a free code editor that works with many different programming languages, making it an attractive option for admins who script. With help from the VSCode PowerShell extension, IT pros on Linux can write PowerShell scripts to use with PowerShell Core, the open-source version of Microsoft's scripting and automation tool.
Administrators who prefer to work in ISE should explore some of the features in VSCode. In addition to the VSCode PowerShell extension, VSCode uses Git for version control and comes with built-in PowerShell snippets, an integrated terminal and the PowerShell Script Analyzer which sets rules straight from the command palette to produce cleaner code.
How to set up the VSCode PowerShell extension
Install the PowerShell extension through the extensions panel in VSCode, then configure user settings, such as specific versions of PowerShell in VSCode, to customize the development experience. VSCode works on Mac, Linux and Windows, unlike the Windows-only PowerShell ISE. Linux and Mac users must use the cross-platform PowerShell Core.
The VSCode integrated terminal makes switching between editing scripts and running PowerShell commands seamless. The editor and integrated terminal can share data, such as variables, because they run in the same PowerShell session.
With the VSCode PowerShell extension installed, the editor provides a modern development experience for PowerShell users with many features and customizations unavailable in other editors. The video that accompanies this article goes into further detail on the benefits of using VSCode.