Prof. Powershell

Apply ISE Pack As Needed

I use PowerShell's Integrated Script Editor Pack mostly for one must-have feature, but there's a whole host of cool scripting tools you might also want to check out.

There's no question that the Windows PowerShell Integrated Script Editor is a superior alternative to Notepad. If you don't have a commercial script editor, then you should at least be using the ISE. Granted, the ISE by design is simple, but it is extensible. Fortunately someone else has already done the extending.

The PowerShell Pack that is part of the Windows 7 Resource Kit contains 10 modules for extending PowerShell. One of those modules, the ISEPack, is designed to extend the ISE. You can download the PowerShell pack here.

After you install the PowerShellPack, open an ISE session and import the ISEPack module:

Import-Module ISEPack

You may not notice much happening. But take a look at the menu and you should now see an Add-Ons menu. Underneath you'll see ISEPack and from there all of the available commands. Most of these commands assume you have a script open in the editor and something selected. Or go ahead and create a new script. Enter a command like this:

get-process w*

With your cursor anywhere in the line, press F6, which invokes the ISEPack command to execute the current line. Or perhaps you don't recall what properties are available for a process object. Select the cmdlet name, get-process, and press Alt+M. You'll get an Out-Gridview result displaying the process object.

Or perhaps you'd like to research this cmdlet. Select the cmdlet name and press Ctrl+B. Your browser should open to a Bing page showing results for the selected text; in this case, it's the cmdlet name.

My favorite feature is toggle comments. Very often when developing a script I want to take a block of commands and comment them out. Without the ISEPack I have to manually insert the comment character at the beginning of each line. But with the ISEPack all I need to do is select the lines and press Ctrl+Alt+C. The lines are now commented. Pressing Ctrl+Alt+C again toggles the comments off. This is the primary reason I use the ISEPack.

I hope you'll try out many of the other ISEPack features. Be sure to read the help files about_ISEPack_Readme and about_ISEPack_Modules to learn more.

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at Petri.com, and a frequent speaker at technology conferences and user groups.

comments powered by Disqus
Most   Popular