Weekend Scripter: Great PowerShell ISE Features for Beginners

Summary: Microsoft Scripting Guy, Ed Wilson, talks about some of the greatest Windows PowerShell ISE features for beginners.

Microsoft Scripting Guy, Ed Wilson, is here. One of the great things about the Windows PowerShell ISE is that it can help a wide level of scripters. For example, if you are very experienced with Windows PowerShell, there is an API that can be used to create your own add-ons for the Windows PowerShell ISE. This can help to smooth many of the rough spots that sometimes annoy users of the Windows PowerShell ISE. I love this feature.

But when I am teaching Windows PowerShell to beginners, I don’t begin by talking about the object model. Instead, I point to some other features that are really helpful.

Red squiggly lines

One of my favorite features of the Windows PowerShell console is what I call “red squiggly lines.” When I type an incomplete command, the red squiggly line lets me know that if I were to run the command at this time, Windows PowerShell does not think it would work. And if the red squiggly line is there, an error will arise.

In the following image, a red squiggly line tells me that Windows PowerShell is expecting something else. I have an empty pipeline character, so there must be something to accept the pipelined input.

Image of menu

The red squiggly lines will tell me if I have opened (but not closed) brackets, braces, and parentheses. It looks for dangling pipes and stuff like that. But although it knows basics of syntax, it cannot tell me about logical errors. So, the following image shows an endless loop, even though it meets syntax basics.

Image of menu

Snippets save the day…often

A better way for a beginner to write a For loop (rather than trying to remember all of the moving parts and their order, so to speak) is to use a snippet.

To write the previous For statement without an error is trivial when I use snippets. First, I click Start snippets from the Edit menu. (I find it strange that this is not on the View menu, as might be expected.) I can also use <CTRL-J> to start the snippet tool instead of having to mouse around to find Start snippets from the Edit menu. The following image shows a view of the snippet tool:

Image of menu

All I need to do is to scroll up or down until I find the snippet I want to insert. If I select a snippet, the tool shows a tip as to what it contains. Then I click again (or simply double-click if I know what I want), and the snippet is inserted at the current insertion point of my code.

When I insert my For snippet, I can edit it and see immediately what my previous issue was. I had the ++ in the wrong place. The code now works, and it was definitely less typing.

Image of menu

These are a few of my favorite things for beginners in the Windows PowerShell ISE. Have a wonderful weekend.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy 

Comments (2)

  1. Florian Frank1991 says:

    One of my favorite feature in ISE is IntelliSense (AutoCompletion with TAB or STRG+SPACE). It helps me to get a quick overview over the available cmdlets, functions, parameter and so on.

  2. turbomcp says:

    I totally forgot about this feature
    great stuff

Skip to main content