Latest posts by Michael Pietroforte (see all)
- Results of the 4sysops member and author competition in 2018 - Tue, Jan 8 2019
- Why Microsoft is using Windows customers as guinea pigs - Reply to Tim Warner - Tue, Dec 18 2018
- PowerShell remoting with SSH public key authentication - Thu, May 3 2018
One of the things that really puzzles me about PowerShell is its shell. Obviously, the “Power” in PowerShell is not in any way related to its official user interface. I believe this shell hasn’t changed since Windows 95, and it was already an awkward command-line interface (CLI) at that time. I think I could fill a book with all its shortcomings. If you also work in the Linux world, you know what I am talking about.
However, Windows comes with a command-line interface for PowerShell that fits much better with this powerful language. By the way, if you can't find PowerShell ISE on your Start Screen, this post explains how you can make ISE tile visible. Many admins think that the Windows PowerShell Integrated Scripting Environment (ISE) is only for writing scripts. Perhaps the reason is that “ISE” sounds a little like “IDE” (Integrated Development Environment). Thus, whenever they need a PowerShell console, they launch this old-fashioned “Windows 95 DOS prompt.”
PowerShell ISE as CLI
Of course, PowerShell ISE is a great scripting tool; however, it is also a powerful CLI. You can simply reduce the size of script editor or minimize altogether, and then you have a very nice PowerShell console. Below, I list 10 reasons why you should use PowerShell ISE as your primary CLI. In this article, I talk about the PowerShell prompt or console when I mean the official shell, and I speak of the PowerShell ISE prompt when I mean the integrated CLI in PowerShell ISE.
Copy commands ^
Did you ever try to copy a command that is longer than one line at the PowerShell prompt? I don’t know who had this idea that it could be useful to mark text as a block instead of selecting it line by line. I don’t remember ever needing such a strange way to select text. I am also not aware of a method of selecting text on the console without a mouse. In the PowerShell ISE, you can highlight text as in any editor—that is, line by line and by using the SHIFT + cursor keys. You can copy the text as you are used to with CTRL+C.
Select text in the PowerShell console
Paste commands ^
Pasting is also somewhat inconvenient on the console. The fastest way is to right-click (if Quick Edit Mode is enabled), but real PowerShell geeks avoid clicking whenever possible. ALT+SPACE+E+P is not really a convenient alternative. In PowerShell ISE, you can just paste as usual with CTRL+V. However, what is much more important for me is that my clipboard history tool ClipX works in PowerShell ISE. Scrolling through previous commands with the cursor keys is only half as efficient because you see all your previous commands at a glance with ClipX. Note that if you want to use ClipX with an elevated PowerShell ISE console, you also have to run ClipX with admin privileges.
I also find it very convenient to have an editor right at hand in PowerShell ISE. Sometimes, when I experiment with a long command, I keep different versions of it in an editor and copy and paste it to the PowerShell ISE prompt. (Yeah, I try to avoid type-type-type whenever I can.) I also sometimes launch a command directly from the PowerShell ISE by pressing F5. If I have several versions of the command in the editor, I just select a particular line and press F8. You can also run part of a command in the editor by highlighting the portion and then pressing F8.
Run selection in PowerShell ISE
Switch to scripting ^
I often notice that the things I want to do are not as simple as I assumed. Piping is fun, but sometimes you reach a point where you realize that you had better write a little script. Since I already have most of the commands in my editor from my experiments, I can easily switch from CLI mode to scripting. Honestly, I don’t think that there is a real difference between using a CLI and scripting. A command is just a script with a single line.
Window size ^
One of the most annoying shortcomings of the PowerShell prompt is that you can’t just enlarge the window with the mouse; if you click the full screen symbol, you only get a window with the number of lines you configured in the window properties. By contrast, the PowerShell ISE window behaves like a normal Windows application and can easily be resized. PowerShell commands tend to be quite long, and they are easier to read and edit if you can keep them on one line without a line break.
Context sensitive help ^
One very useful feature of the PowerShell ISE editor is the context sensitive help. When you start typing, a little window pops up that displays the cmdlets that match the entered text. So, if you are not sure about the exact name of the cmdlet, you can start typing and then scroll through the different options. Also very useful is that, if you type “-” after entering the cmdlet’s name, PowerShell ISE will show you the available parameters. After you complete the parameter, you even get a list of its possible options. This only works in the editor, not in PowerShell ISE’s CLI. But this is not an issue since you can just launch the command from the editor with F5 instead of pressing Enter.
PowerShell ISE - Context sensitive help
Command Add-on ^
If you click the Command Add-on in PowerShell ISE’s toolbar, a sidebar will show up on the right where you can search for cmdlets. You can also restrict your search to a particular module.
PowerShe ISE - Show Command Add-on
Syntax highlighting ^
Of course, PowerShell ISE also supports syntax highlighting. This helps avoid syntax errors and makes your command easier to read when you verify it before you fire it up.
PowerShell ISE - Syntax highlighting
The PowerShell ISE tabs come in handy if you work on multiple administration tasks simultaneously. I find it much more convenient than working with multiple PowerShell console windows. For each tab, you have your own editor.
PowerShell ISE tabs
If you work a lot with PowerShell, you will notice that it strains your eyes a lot. Coders are an eye doctor’s best customers. If you worked all day on the CLI and you simply can’t see the syntax error, you can do your eyes a favor and enlarge the fonts. As with any other Windows application, you can zoom with the mouse wheel while pressing the CTRL key. Another way to zoom is CTRL + to increase the font size and CTRL - to decrease it. This works in the editor and in the CLI of PowerShell ISE.
Did I convince you? If not, why do you still prefer the PowerShell console over the PowerShell ISE CLI?
- NEW: PowerShell ISE Module Browser
- PowerShell Script Browser and Script Analyzer – Must-have tools for scripters