1. Launching the ISE
The Windows PowerShell Integrated Scripting
Environment (ISE) is a handy tool you can use to create, test, and
debug PowerShell scripts. You can launch the ISE by clicking Start, All Programs, Accessories, Windows PowerShell, Windows PowerShell ISE.
Figure 1 shows the ISE in action with the different areas labeled, and the following table explains these sections.
PowerShell ISE | Comments |
---|
Menu bar | Windows dropdown menus. |
Toolbar | Buttons for key tools. |
PowerShell tab | Different
PowerShell tabs can have separate scripts and variables. It’s common to
create a different PowerShell tab when connecting to a remote computer.
Note
You can have as many as eight PowerShell tabs open at a time.
|
Script tab | Shows the name of script you’re currently working on. Multiple scripts can be open at a time.
Tip
Hover over the tab and the full path to the script displays in a tooltip.
|
Script pane | Shows
the script you’re currently working on. The line numbers automatically
display in the script pane but are not in the script. |
Output pane | The script output goes here when scripts or PowerShell commands are executed. |
Command pane | A regular PowerShell command prompt. Any PowerShell commands can be executed here. |
Cursor position | Shows the current position of the cursor.
Note
PowerShell error outputs show the cursor position. You can use this
hint to get right to the source of the problem when troubleshooting a
script.
|
2. Exploring the ISE
The following table shows the default buttons on the toolbar in order from left to right.
PowerShell ISE Toolbar Buttons | Use |
---|
New | Creates a new script tab. |
Open | Opens an existing script or file. |
Save | Saves the script or file in the current tab. |
Cut | Cuts selected text and copies it to the Clipboard. |
Copy | Copies selected text to the Clipboard. |
Paste | Pastes contents of the Clipboard to the cursor location. |
Clear Output Pane | Clears all content in the Output Pane. |
Undo | Reverses the action that was just performed. |
Redo | Performs the action that was just undone. |
Run Script (Green arrow) | Runs a script. F5 also runs the script. |
Run Selection | Runs a selected portion of a script.
Tip
You can highlight any portion of a script and run it by itself by clicking this button or by pressing the F8 key.
|
Stop Execution | Stops a script that is running. The Ctrl+Break and Ctrl+C combinations also stop the script. |
New Remote PowerShell Tab | Creates
a new PowerShell Tab that establishes a session on a remote computer. A
dialog box displays and prompts you to enter details required to
establish the remote connection. |
Start PowerShell.exe | Opens a PowerShell Console. |
Show Script Pane Top | Moves the Script Pane to the top in the display. This is the default display. |
Show Script Pane Right | Moves the Script Pane to the right in the display. The output pane moves to the top with the command pane at the bottom. |
Show Script Pane Maximized | Maximizes the Script Pane. |
You can use several keyboard shortcuts with the ISE. The following tables show many of these.
PowerShell Shortcuts Keys | Comments |
---|
F1 | Launches Help. |
F3 | Launches the Find dialog box to search the script. |
F5 | Runs the script. |
F8 | Runs a selected portion of a script. |
Ctrl+T | Creates a new PowerShell tab. |
Ctrl+Shift+P | Starts PowerShell. |
Ctrl+N | Creates a new script tab. |
Breakpoints allow you to pause a script when it
reaches the breakpoint. You can set breakpoints on any line in the
script. The following keyboard shortcuts are used with breakpoints.
Breakpoint shortcut keys | Comments |
---|
F9 | Toggles breakpoint. Position the cursor where you want the breakpoint and press F9 to create it. The script pauses at the breakpoint. |
Ctrl+Shift+F9 | Removes all breakpoints. |
Ctrl+Shift+L | Lists all breakpoints. |
F10 | Steps over. |
F11 | Steps into. |
Shift+F11 | Steps out. |
F5 | Runs/Continues. |
Shift+F5 | Stops Debugger. |
Ctrl+Shift+D | Displays the call stack. |