Recently I was busy scripting a Exchange migration (yes, i also do Microsoft besides VMware) in Powershell (Automating Cross-Forest moves from Exchange 2007 to Exchange 2013 and related tasks) for a customer of mine and got annoyed by the limited functionality Windows Powershell ISE (Integrated Scripting Environment) is providing us by default,. I decided to look for a decent and affordable editor for Powershell. That’s when I stumbled upon ISESteroids (//www.powertheshell.com/isesteroids2/).
ISESteroids is a powershell module which adds all kind of handy functionality to the standard Windows Powershell ISE. Because I really liked it from the start I wanted to write a small blog article about it to share with you guys the 3 functionalities i like most and hope you find them just as useful as I do for writing Powershell scripts, functions and modules. For a total overview of the features of ISESteroids i’d like to point you to //www.powertheshell.com/isesteroids2/feature-overview/
One of my most favourite functionalities in ISESteroids is the automatic refactoring it can do. The function turns your script/module into a well-formatted and readable Powershell script (following Powershell-scripting best practices) automatically by running your powershell script through selectable modules (or all modules at once) and without you having to a thing manually.
Some examples of things it will automatically correct for you:
- Reformat Hashtables (All key-value pairs get an individual line and get aligned)
- Turn double quotes into single quotes when appropriate (when no variables are used in the string)
- Remove blank lines in script blocks
- Align all the braces
- Replace Aliasses with command names
- Replace commands and command parameters with the correct casing
- Adjust spacing
It just makes your script look better and more readable without you having to do anything about it!
Another refactoring tool which I use a lot is the renaming of variables, which automatically fixes all occurrences of that variable in the correct scope, without me having to think about where I have to change the names. This comes in handy when I change my mind again about how I should name the variable (what’s does the variable really contain?).
Context Sensitive Help
I think everybody who does some powershell scripting knows the Get-Help command (or it’s alias Help). ISESteroids adds context sensitive help to ISE which gives you the syntax of the command you currently highlighted. If you hover over the parameters in the help it gives an explanation of the parameter and the properties of the parameter (i.e. Is it required, does it accept pipeline input).
The help also contains interactive examples which you can double-click on and they then get copied to your shell where you then can modify the command if needed and execute it (saves you some copy&pasting). If you hold shift when hovering over the example it allows you to select what to do with the fragment. This allows you to put it in the shell, put it in the code editor, execute it immediately or put it on your clipboard (why should you even use the last option?!)
The last feature I would like to talk with you about is the Snippets function which lets you add templates of code to your code by typing and abbreviation and hit tab to complete the text-fragment. For example typing cmdlet and hitting TAB gives you a complete definition of a cmdlet which you only need to fill out. This helps you to always create your functions the same way and document them on the fly, because also the blocks used for creating documentation are added on-the-fly. Of Course you can also choose to add you’re own snippets or change the snippets which are packaged with the product to your own liking.
These are only 3 of the many features ISESteroids has to offer, I would really like to encourage you give it a look for yourself if you are also missing functionality in the Powershell ISE like me. There’s a free trial available which allows you to use ISESteroids for 10 unique days, there also (free/discounted) licenses available for Startups, Microsoft MVP’s, Trainers and private home users (you can get one by spending a couple of hours writing a blog posts about it).
I decided to go and buy a individual ‘Powershell Specialist’ license ($99) which helps the guys/girls develop this great add-on and gives me a good feeling about having a specialist tool 🙂 !
I think the license is really worth the money, because it saves me a lot of work scripting and automates a lot of things I normally did manually (especially with refactoring, laying out the script and troubleshooting).