Microsoft Windows PowerShell DSC (Desired State Configuration) What is PowerShell and how to use it: The ultimate tutorial

Microsoft Windows PowerShell Integrated Scripting Environment (ISE)

What is Windows PowerShell Integrated Scripting Environment (ISE)?

The Windows PowerShell Integrated Scripting Environment (ISE) is a graphical user interface and front-end hosting application for Windows PowerShell. The ISE lets developers run PowerShell commands and create, test and refine PowerShell scripts without operating directly in the traditional PowerShell command-line interface (CLI).

At first glance, PowerShell ISE is a convenient graphical user interface (GUI) for the PowerShell console. The ISE provides a variety of editing controls, user help and other ease-of-use features that aren't readily present in PowerShell. For example, the ISE supports multi-line editing, tab completion, syntax-based coloring, selective execution, context-sensitive help and multi-language support. Menu options and keyboard shortcuts in the ISE mimic many of the common tasks traditionally performed in the PowerShell console.

PowerShell ISE features

A typical Windows 10 PowerShell ISE appears below. The conventional console area -- the Console pane -- is delineated in dark blue. A suite of familiar file and view controls are positioned along a top toolbar, including buttons to start a remote PowerShell session as well as a conventional PowerShell console.

PowerShell ISE
The Windows 10 PowerShell ISE interface can provide PowerShell commands.

PowerShell ISE users can access help for the ISE by clicking the Help button in the top toolbar and selecting Windows PowerShell ISE Help. This opens a web page that offers descriptions and details of the PowerShell ISE and further reading.

One key feature of the ISE is access to a complete library of PowerShell scripting language commands available from a command window located on the right. Developers can locate a command alphabetically and, by command group -- which is filterable -- drill down to enter all relevant parameters within the right panel. They can then insert the properly configured command into the console without the need to type the entire command by hand.

A second core feature of ISE 2.0 is support for up to 32 concurrent execution environments. Previous versions of ISE supported only up to eight. This might seem like a great deal of multitasking. But developers can use this capability to work with related scripts and make real-time tweaks and enhancements while seeing the immediate effects of their changes across other related scripts.

Other features of the ISE are related mainly to editing support. For example, the ISE supports multiline editing, allowing blank or new lines to be inserted beneath selected lines within the Command pane. Selective execution enables developers to run or test desired parts of the script by highlighting the desired portion of the script and clicking the Run Script button or pressing the F5 button. Similarly, users can add breakpoints to check variables and review script behaviors at critical points. Text copying and pasting is supported. A context-sensitive help system provides additional information about any item. The ISE itself has some customization options, and users can tailor text colors, fonts and layouts; add line and column number; and adjust keyboard shortcuts.

Later versions of the PowerShell ISE add autocomplete capabilities for cmdlets, parameters, files and values. Autosave capabilities store the script every few minutes to avoid content loss if a crash occurs. The Snippets function saves short segments of code for reuse, and a most recently used list offers fast access to recent files. PowerShell ISE merges the command and output panes into a single view to more closely reflect the response of the PowerShell console. Users can extend the features and functionality of PowerShell ISE with code based on the ISE Scripting Object Model.

Uses of PowerShell ISE

The Windows PowerShell ISE is fundamentally an editing tool that is used to create, edit, test and execute PowerShell scripts in Windows environments. The ISE offers a more flexible and interactive editing and execution environment than a traditional PowerShell console.

  • Save time and reduce errors when creating scripts. Scripts routinely employ long sequences of complex command lines, each with granular parameters. It's possible to construct the same script in PowerShell and the PowerShell ISE. But ISE features such as an interactive index of available commands and context-sensitive make it easy to find important commands, select proper parameters within the pane and then drop the properly formatted command into the script. This -- along with other editing niceties such as copy and paste -- can save time by speeding up proper command formatting as well as reducing common typing and syntactic errors that can be time-consuming to find and fix.
  • Improve script debugging and testing. A script is basically a short piece of software where the instructions involve the PowerShell scripting language. As with any software, there are bound to be errors, oversights and unintended consequences produced by the script. ISE features such as an integrated debugger and syntax highlighting can highlight common errors and recommend fixes before the script is ever executed. Additional capabilities such as breakpoints and selective execution let developers check desired portions of the script and intentionally stop execution at critical points in the script to inspect the state of important variables and other behaviors.
  • Get greater insight into related scripts. Scripts can be highly interactive entities where one script interacts with other scripts. This can result in complex relationships that can be difficult to follow with vanilla execution engines, such as PowerShell. The ISE supports multiple simultaneous execution environments, letting developers load and follow the cause-and-effect relationships among several scripts at the same time. The ISE helps with troubleshooting, especially after a change in one script triggers an unexpected behavior or error in another.

PowerShell vs. PowerShell ISE

PowerShell and PowerShell ISE both provide fundamentally the same scripting capabilities for Windows environments. The principal difference between the two is convenience. PowerShell is a simpler and more straightforward scripting and execution environment, while the ISE provides more flexible and forgiving editing and execution features. PowerShell can be a good platform for simple tasks where actions are clear. The ISE is preferable when scripting tasks are larger, more complex and interrelated.

A comparison of word processors offers a sound analogy. A tool such as Notepad can be ideal to create and edit notes and short, straightforward text. But a tool such as Word provides far more editing features, fonts, colors, formatting, and spelling and grammar checks. Thus, Word could be a preferable tool for complex tasks, such as professional report writing and developing a book chapter. Still, both tools are word processors.

Advantages of PowerShell ISE

To summarize, the advantages of PowerShell ISE include the following:

  • saved time;
  • fewer errors when creating scripts;
  • similar keyboard shortcuts replicating tasks possible in PowerShell;
  • improved debugging and testing; and
  • greater insight into related scripts.

    Disadvantages of PowerShell ISE

    The disadvantages of PowerShell ISE include the following:

    • unnecessary complexity for certain tasks;
    • lack of support for interactive sessions;
    • limited paging;
    • lack of support for certain legacy commands.

    How to run PowerShell ISE

    Windows PowerShell ISE is available in Windows 11, 10, 8.1, 8.0, and 7 as well as Windows Server 2008 R2 SP1 and later. PowerShell ISE can be launched on a PC in either one of two ways:

    • Click Start, search for PowerShell in the Search bar and then select Windows PowerShell ISE from the resulting list of apps.
    • Open the Windows Run prompt or any command shell, type powershell_ise.exe and press Enter.

    Once the ISE is launched, users can employ the ISE in several common ways.

    • Use the Console pane. Once the ISE starts, it functions exactly like PowerShell, and users can enter commands into the Console pane -- the large, dark blue area of the GUI -- just as if it were PowerShell. For example, to run a command, just type the command into the Console pane at the command prompt and press Enter. Users can enter and execute multiple commands by using Shift+Enter -- basically a line return -- between commands. Users can stop the execution of a command with the Stop Operation button in the GUI or with Ctrl+Break on the keyboard.
    • Create and use tabs. PowerShell ISE 2.0 supports up to 32 simultaneous but independent execution environments or sessions. Each environment is referred to as a tab, and users can switch between tabs at-will. To create a new tab, click New PowerShell Tab on the File menu. Users can opt to create and use a remote PowerShell tab to establish a session on a remote computer, though this requires additional details to log in and access the remote computer.
    • Manage breakpoints for debugging. The ISE supports the use of breakpoints, which are points in the script where operation is paused for manual inspection of variables and environments. Once a breakpoint is encountered, the user can run commands to examine the state of the script, make changes to the state of the script and even resume operation of the script. Users can employ line breakpoints to pause at specific places, variable breakpoints to pause when a desired variable changes and command breakpoints to pause when a desired command is encountered. The ISE lets users set, remove and enable/disable breakpoints.
    • Run a profile when the ISE starts. A profile is a script that runs when a session is started. A profile can be vital to configure the PowerShell ISE environment for aliases, functions, variables, colors and fonts, and other preferences used in the ISE session or tab. Users can create, select, edit and enable/disable profiles in the ISE.
    • Write and run scripts. The core use for the ISE is to write, edit and run Windows PowerShell scripts. Script files can include conventional script files (.ps1), script data files (.psd1) and script module files (.psm1) as well as other files such as configuration files (.ps1xml), XML files and text files. To create a new script file, click New on the toolbar or click New on the File menu. The new empty file appears in a new file tab. Users can add commands and data to compose the script. To run the script, click Run Script on the toolbar or click Run on the File menu. To run just a part of the script, select or highlight the desired portion of the script and click Run Selection on the File menu or click Run Selection on the toolbar.

    Creating a simple script in PowerShell ISE

    PowerShell files can be opened and edited in the PowerShell ISE script pane. Several file types are supported including script files (.ps1), script data files (.psd1) and script module files (.psm1) as well as configuration files (.ps1xml), XML files and text files. To create a new script file:

    • Click the New Script icon in the toolbar or click File and then New in the top tools. A new tab opens for the untitled file, which will be a .ps1 script file by default.
    • Type the new script. For this exercise, consider writing a simple statement to the monitor, such as Write-host "This is a test output to the monitor"
    New PowerShell script
    Enter a new script in the new tab.
    • Save the new script by clicking the Save Script icon in the toolbar or click File and then Save or Save As in the top tools.
    • Enter a useful name for the script, such as testscript1.ps1.
    • Run the script by clicking the Run Script icon in the toolbar, or click File and then Run in the top tools. For this example, the text will appear in the PowerShell pane.
    PowerShell pane
    The new script executes in the PowerShell pane at the bottom.

    Note that script execution is normally blocked by default as a security measure. If the script refuses to run, it might be necessary to change the execution policy on the computer so that scripts will run.

    Users can take advantage of PowerShell ISE debugging features by running a portion of the script. For example, users can simply select or highlight the desired portion of a script and then click File and then Run Selection. Similarly, scripts can be halted deliberately by clicking Stop Operation on the toolbar or typing CTRL+Break.

    Microsoft support and replacement

    The PowerShell Integrated Scripting Environment was first introduced with Windows PowerShell v2. The ISE was revised and updated for PowerShell v3. As of February 2020, the ISE is supported in all versions of Windows PowerShell up to v5.1.

    It's important to note that the ISE is no longer in active development. Although the ISE is still supported with security and functional patches, there are no plans to update the ISE for PowerShell v6 or later. PowerShell v6 and later users might prefer to forego the ISE in favor of alternate ISE platforms such as Visual Studio Code with the PowerShell Extension available through the Visual Studio Marketplace.

    Other alternatives for PowerShell ISE include Sapien PowerShell Studio 2023, Idera PowerShell Plus and Notepad++.

    This was last updated in February 2023

    Continue Reading About Microsoft Windows PowerShell Integrated Scripting Environment (ISE)

    Dig Deeper on IT operations and infrastructure management

    Cloud Computing
    Enterprise Desktop
    Virtual Desktop