- Poll: How reliable are ChatGPT and Bing Chat? - Tue, May 23 2023
- Pip install Boto3 - Thu, Mar 24 2022
- Install Boto3 (AWS SDK for Python) in Visual Studio Code (VS Code) on Windows - Wed, Feb 23 2022
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.
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
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.
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
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
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
Join the 4sysops PowerShell group!
Your question was not answered? Ask in the PowerShell forum!
Great point but just pointing out there are some limitations. As some cmdlets (i.e. start-transcript) as well as some DOS commands (i.e. nslookup, wmic, etc.) but start-process can be a workaround. A useful list of prevented commands can be found using $psUnsupportedConsoleApplications
I can’t say you convinced me since I already knew it was the better CLI. I still use the regular prompt for quick work…I’m used to its faults. I’ve been trying out a different one, though…ConEmu. The ISE just feels like overkill for quick commands, but the classic console lacks a lot…I wanted something in between.
Still, I do find myself spending a lot of time in the ISE.
jkavanagh58, thanks for the hint! Unfortunately, there are some other things which don’t work in ISE such as $host.UI.RawUI.ReadKey(“NoEcho,IncludeKeyDown which I use in scripts to wait until a key is pressed. I wonder why some things don’t work in ISE. Doesn’t really makes sense.
Laurel, thanks for the tip about ConEmu. We might do a review. I suppose there are some other good third-party PowerShell consoles..
I am very new to the scripting world and I had a question about this one. You said your script relies on a keypress. I was very interested to know what the purpose of the script was and how the keypress functioned. I hope this question makes sense. Thanks!
Dave, I meant this command: $x = $host.UI.RawUI.ReadKey(“NoEcho,IncludeKeyDown”)
On a PowerShell console it pauses the execution of your script until you press a key. However, In PowerShell ISE the command produces an error message. It is not a big issue because you can always find another way to to get the same result in ISE.
I just used this command as an example that you can never be sure that a script on the console behaves exactly the same way in PowerShell ISE which is not good in my view because it complicates debugging.
You missed one of my favorites: File > New Remote PowerShell Remote Tab.
Oh indeed. The Remote Tab is also a nice feature.
Great article! Sorry for a late comment, but it’s still actual.
I’d like to point out that “6. Context sensitive help” actually works in CLI (at least starting PS 3). You can force it to show with “Ctrl+Space” (same as IntelliSense in Visual Studio), which essentially mean that you can have both unix-style auto completion (ctrl+space) and windows-style auto complition (tab) at the same time and use them interchangeable! I found myself use this feature extensively and in most cases IntelliSense is smart enough to calculate types down in pipeline which is extremely helpful. It also reduce Get-Help usage significantly (as you said in a blog post).
ISE definitely has some limitations, but other all I’m surprised why people don’t use it extensively as a shell. I tried a lot of options and ISE works best for me.
Being a UNIX admin since 1985, I fully appreciate a functional shell.
However I do not use ISE as a console because it does not support pagination.
Having to scroll back constantly when a large text content is displayed, is a deal breaker for me in itself.
Jeffrey Snover has hinted recently at console improvements in the pipeline.
Hopefully there is light at the end of the tunnel.
Martin, the light is already in the tunnel.
There’s one more strange benefit observed in powershell_ise.exe vs. powershell.exe
1. run VBox (v4.3.24) in both:
vboxmanage.exe controlvm “YourVMName” poweroff
vboxmanage.exe snapshot “YourVMName” restore “YourSnapshotName”
vboxmanage.exe startvm “YourVMName”
2. manually power off the VM (click on “x” in right bottom corner and select Power OFF)
This emulates some unexpected VM crash. Others may include Blue Screen or oth.
3. in the middle I read some VM properties – this seems not related
vboxmanage.exe guestproperty wait “YourVMName” “KEEPALIVE” –timeout 100000
4. after that point:
– powershell.exe cannot re-launch the VM: the following commands just return immediately
vboxmanage.exe controlvm “YourVMName” poweroff
vboxmanage.exe snapshot “YourVMName” restore “YourSnapshotName”
vboxmanage.exe startvm “YourVMName”
– powershell_ise.exe is working properly: VM is restored after crash
Both scripts are run in fully automatic mode (no manual step-by-step & related timeouts).
At the moment I have no explanation for this behavior.
wow! u convinced me
The most important reason that I use POWERSHELL than MSDOS is its ablitity to find UTF8 strings in files(such as simplified Chinese). FINDSTR cannot do this.
The most inport reason that I use ISE instead of PS is It can deal with Chinese perfectly ,while PS has some bugs.
Now your article give many other reasons I do not know before. Thank you.
Powershell ISE as an editor is great. But every time I decide to use it, I remember why I never use it. Basically, it just does not work right.
I recently went though this again. I was pulling my hair out trying to figure why my Powershell commands kept throwing errors. Checking and double-checking my syntax. Then it struck me — ISE! Switched over to the regular Powershell and voila — all worked just like it is supposed to.
So thanks, but no thanks. If ISE ever starts consistently running cmdlets properly I’ll use it. Until then, it is just another frustration factor to deal with.
Yeah, there are cases were ISE behaves differently and I never understood why. However, it doesn’t happen often and then you usually notices it. It seems ISE is now dead anyway because there is no edition for PowerShell Core.
I think there is no new version of the ISE because Microsoft is really moving people towards VSCode which is pretty great so far and continually improving.
You are right. VS Code is great. I just tried it the other day on a Mac with the newly released PowerShell Core. It needs a little tweaking to get a ISE-like environment. The only thing I don’t like is that VS Code connects to countless of external sites whenever I click somewhere. Hard to tell for what purpose. I am tempted to block it all.
Guys does someone know why a module (PM1) works in ISE but not in the PS Console.
Its a little script what I wrote to logon on 365 what write the credentials in the registry.
Don't get error messages.
Strange thing is that the same script works within the console when I save it as PS1.
So not working as PM1 but as PS1 no problem.
Well.. the extension needs to be .psm1 for a module..
You can post your code here, or possibly start a new thread for it.
Make sure you have the O365 module installed in the 5.1 version of PS.
If you are using it in PS6 or PS7 it won't work in ISE without the module.
One rather large let-down with the ISE is it has no straight forward 'intended' upgrade path; It appears that M$, in their immaculate stupidity, did not recognize that this tool should be upgraded with more modern versions of powershell, so they did not develop the app with this in mind, or at-the-least do not support it, as I can't find any documentation to do so in any case.
Microsoft is pushing people to VSCode. There are apparently a lot of inherent limitations to the ISE.
But, thanks to some interesting experimentation by Adam Driscoll (Ironman software), you can make it work. https://ironmansoftware.com/using-powershell-core-6-and-7-in-the-windows-powershell-ise/
Use VSCode now (in 2021). Very simple. ISE is dead these days. Times change.
And it’s not a big deal, ISE still works, for version 5.1. There exist just better tools, e.a. the VSCode extension.
Others apparantly complain that Microsoft doesn’t upgrade ISE anymore or “pushes” people towards VSCode.
But VSCode is an amazing tool and it’s open source.
Personally, as a developer, I was already using VSCode for multiple code editing tasks before, after I started learning PowerShell I started searching for more VSCode extensions later and decided that I wanted a PowerShell plugin as well, so I choose it and noticed that worked very well. So I don’t feel being pushed anyway.
Actually I feel more “pushed” by the fact that the PowerShell plugin wants you to change the theme back to a ISE style, while I am just happy with the dark theme that VSCode has.