In this guide , we’re going to explore a better way to create your scripts.
It’s all about the Integrated Scripting Environment (ISE).
ISE ISE Baby…
Open the ISE by typing
ise in the PowerShell console.
In the right side you can search for commands in all modules by simply typing hte name in the box. THis is a great nice to have but honestly I never use it. You can do it all from the shell itself and it just wastes valuable screen space. Press Alt + vd to hide it (you can always get it back from the View menu).
Alright, so let’s look at the scripting pane. Press Ctrl + n to open the scripting pane. You’ll notice that it splits the screen in half.
You type the scripts in the script pane and the results show in the bottom console pane.
If you have one monitor, press Ctrl + 3 to maximize the script pane and then use Ctrl + r to toggle between the full screen script pane and console views. That way you type your script in the script pane, execute it and the Ctrl + r switch over to your console view to check out the results.
If you have two monitors, press Ctrl + 2 to split the screen vertically with your console pane on one side and your script pane on the other side.
Now you can maximize the window and position it such that the middle divider lines up with the gap between both your monitors. So you can have your script pane in screen and your help files in the other.
Customizing the Environment
The second thing I like to do is crank up the font size and change the theme.
Press Ctrl ++ a few times zoom in (or just slide the zoom slider to the right in the bottom right corner of the Window). Now type a backtick (under the escape key), single-quote, curly brace and parenthesis.
If you can clearly tell the difference between these in the ISE your font level is at the appropriate size.
Now change the theme to Matrix green by going to Tools, Options and clicking the Manage Themes… button.
Select Monochrome green and smile. You’re ready to hack. haha j/k.
Now go back into the ISE and start typing some cmdlets using tab completion along the way. You’ll immediately notice that you now get a visual list of all the valid options and the colors are coded in a specific way that can make identifying errors very easy.
The other nice thing is when you script the ISE tries to help you anticipate problems.
As I’m typing I’m noticing a red squiggly line under the pipe character. And when I mouse over it I see the ISE is telling me
Hey, don’t stop here you need to add something on the other side of that pipe!
Let me backspace that pipe character out because I want to show you something.
We can run everything in the script pane by pressing F5. Or if we have a bunch of stuff in the pane and we only want to run a selection, we just select the text we want to run and press F8.
In any case, the result will flip over to the full screen Console View.
After you’re done analyzing the output press Ctrl + r to flip back to the Script Pane.
And that my friend is all you need to know about the ISE. There’s more to discover but you already know more than most people.