Put a GUI face on your Windows PowerShell scripting
|Executive Summary: PowerGUI, Quest Software’s free Windows PowerShell development tool, provides a graphical interface with a tabbed environment for script editing and IntelliSense-style prompting. PowerGUI lets you manage your PowerShell snap-ins and also has code snippets to help you create syntactically correct PowerShell scripts. PowerGUI’s built-in debugging feature will help speed your script development.|
I was involved in a project recently where I was converting a number of Windows shell scripts to Windows PowerShell scripts. Fed up with Notepad, I began looking for development alternatives. I knew of Quest Software’s PowerGUI, a free PowerShell development tool, and decided to give it a try. I was hooked in seconds. PowerGUI solved my PowerShell development woes by providing a productive .NET-style development environment for scripts. If you’re into PowerShell development, I definitely recommend giving PowerGUI a try. You can download it from powergui.org/index.jspa. My top ten features of PowerGUI are:
10. Graphical editor—The core of PowerGUI is its graphical editor. As you would expect, the editor provides basic editing and cutand- paste functionality. It also provides a split-view window that lets you work on two different sections of the same script. In addition, the editor provides integrated line numbers on the left side of the window, which makes it easy to locate lines that generate script errors.
9. Tab-based development environment—The PowerGUI development environment uses a tabbed interface. Unlike Notepad’s single-document interface, PowerGUI lets you open multiple scripts simultaneously in different tabs, which facilitates reading related scripts and copying and pasting between them.
8. IntelliSense-style PowerShell prompting—Although it’s not the full-blown IntelliSense that Microsoft Visual Studio offers, PowerGUI’s IntelliSense-style prompting is a real asset in helping you learn about and use the various PowerShell cmdlets. The PowerGUI prompting provides cmdlet name completion, and it also displays the parameters for each PowerShell cmdlet.
7. PowerShell libraries—PowerGUI lets you manage Power- Shell snap-ins that add functionality to your PowerShell development environment, such as providing access to Active Directory, Microsoft Exchange Server, and Microsoft SQL Server. The PowerGUI Library includes several snap-ins that you can download from powergui.org/kbcategory.jspa?categoryID=21.
8. Code snippets—PowerGUI includes templates that make it easier to create syntactically correct PowerShell scripts. PowerGUI’s code snippets are accessed by right-clicking in the editing window. The PowerShell snippets include foreach, Do While, Do Until, For, If, Else, and many other common PowerShell statements.
5. Output window—The Output window is shown in the lower right of the development environment. It displays the output from the currently executing script. It also displays full error messages, which can be a big help during your initial script development.
4. Run in External PowerShell Window—The Run in External PowerShell Window option launches a new PowerShell console window in which to execute your script. I found the Output window most useful during the beginning stages of a script’s development, but I found the external window option more useful near the end of the process because it runs the script just like your production environment would.
3. Script input parameters—Developing your scripts is just the starting point. You also need to run them, and you might need to supply one or more parameters. The Input script parameters here box at the top of the PowerGUI Integrated Development Environment (IDE) lets you provide script input parameters and easily see the value of the parameters that are used. The input parameters are shared between all open scripts in your IDE.
2. Locals window—The Locals window is a really nice debugging feature. Displayed by default in the lower left corner of the development environment, the Locals window shows all of your script variables and their values. It also displays any instantiated .NET objects and lets you drill down into their properties.
1. Integrated debugger—Without a doubt, the integrated debugger is my favorite PowerGUI feature. I’ve been looking for the ability to debug PowerShell scripts for some time, and PowerGUI provides exactly what I wanted. The debugger lets you set breakpoints and gives you the option to single-step through your code. You forget just how useful a good debugger is when you don’t have one for a while. This feature really sped up my script development and helped me to write better scripts.