There's no doubt that Windows PowerShell is the future for Windows administrative scripting. Microsoft has adopted PowerShell as the scripting environment for a number of its products, including System Center Virtual Machine Manager (VMM) 2008, Windows Server 2008 R2, Exchange Server 2007, and the upcoming Exchange Server 2010 release. Even so, in the past, the capabilities found in development tools for PowerShell have lagged behind those found in development tools for other scripting languages. For instance, not very long ago PowerShell scripting editors really only delivered color-coded syntax—they lacked other vital capabilities such as statement completion and debugging capabilities. A lot has changed over the past year, and the current crop of PowerShell editors provides full-featured PowerShell development environments. In this review, I'll look at two of the leading PowerShell editors: iTripoli's Admin Script Editor (ASE) 3.6 and SAPIEN Technologies' PrimalScript 2009. Table 1 compares these products' features. For more information about some of the other choices for developing PowerShell scripts, see the sidebar "Other PowerShell Development Tools."
Table 1: Comparison of the Editors' Features (click to enlarge)
Modern editors should meet several criteria. They should support unlimited undo and redo, as well as provide intelligent help with a variety of scripting languages. In addition to support for multiple scripting languages, you'll want to look at whether the editor provides templates for common coding constructs (e.g., For Next loops and common object creation) and code editing tools (e.g., color-coded keywords).
Another important factor is support for code completion along the lines of Visual Studio's IntelliSense, where the editor can interactively display a drop-down box showing an object's methods and properties. Equally important is the ability to organize your files into projects and have multiple files open in different windows. Being able to perform block mode editing is another handy feature. Last but certainly not least, a good development environment should let you debug scripts by setting breakpoints, single stepping through code, and viewing and modifying the contents of variables.
To see how ASE and PrimalScript 2009 stood up to these criteria, I used them to edit and debug a multi-file set of PowerShell scripts. In the past, I've used this set of scripts for product benchmarking and for testing several standalone PowerShell utilities.
ASE began as a VBScript editor and has been enhanced to support PowerShell. Besides PowerShell and VBScript, it supports Active Server Pages (ASP), AutoIt, KiXtart, HTML, HTML Application (HTA), Windows command shell (.bat and .cmd), XML, XML Schema Definition (XSD), and Extensible Style Language (XSL). You can also use it to edit .ini and .reg files. ASE includes support for PowerShell debugging, 75 new Logon Script Builder templates, support for the Microsoft .NET Framework 3.51, and user-definable color schemes.
ASE runs on Windows 2000 and later and requires the .NET Framework 2.0. However, ASE 3.6 doesn't support Windows 7 (which was troublesome for testing, because Windows 7 is my primary desktop) or Windows Server 2008 R2. Windows 7 and Server 2008 R2 will be supported in ASE's next release.
Installation and Editing
Installing ASE was quick and easy, taking less than a minute. After the installation completes, you have the option to launch it. ASE features a multi-tabbed editor interface, as Figure 1 shows. The icons in the toolbar weren't standard and I didn't really like their look, but they were easy to get used to.
Figure 1: ASE's UI (click to enlarge)
Editing single scripts was easy—ASE provides virtually all of the basic script editing capabilities that you would want. It offers a full-featured editor with unlimited undo and redo, color-coded syntax, and IntelliSense-style code completion. By default, the editor showed line numbers, which can be useful for troubleshooting PowerShell scripts. A handy ChangeLog feature helps you document script modifications. Right-clicking any visible PowerShell cmdlet displays help for that cmdlet at the bottom of the screen.
Unfortunately, ASE didn't want to respect the formatting of my PowerShell scripts; it kept attempting to adjust the indentation of my code to match what it wanted. ASE doesn't provide support for block cut-and-paste. It also doesn't support multi-file projects.
Writing New Scripts
ASE's built-in tools make writing new scripts easy. A set of vertical tabs on the right side of the screen provides access to a set of wizards that help you write PowerShell code. The built-in wizards include the ADSI Wizard, Database Wizard, Script Wizard, WMI Wizard, and XML Wizard. There are also custom wizards you can plug into the editor, such as the Registry Wizard and Uninstall Wizard. These wizards are exceptionally useful and powerful, and they can definitely slash the time required to write new scripts. You just need to pick the task you want to perform, and the wizard writes the required PowerShell code into the editor. The wizards also support VBScript.
Although the ASE wizards would be a real benefit to a Windows administrator who isn't all that familiar with the various object libraries, there is one minor irritation. I found it a bit too easy to inadvertently close the wizard windows, and there was no way to restore the default setup.
ASE offers ScriptBits, a small set of code templates for PowerShell, VBScript, and KiXtart. You can create your own ScriptBits and add them to ASE's standard collection.
Running and Debugging
When I initially ran some scripts, I encountered signing errors, which I didn't expect. The default signing settings were set to Restricted. ASE wouldn't let me change these settings until I restarted the program using the Run as administrator option. After making the change, ASE executed PowerShell scripts like I expected. The scripts' output was directed to an Output pane shown at the bottom of the editing window.
ASE provides excellent debugging support. Clicking the Active Debugger icon starts the PowerShell script debugger. The debugging pane, which you can see at the bottom of Figure 1, shows the local variables, script output, watched variables, and call stack. The debugger lets you set multiple breakpoints by clicking in the right margin of the editing window. Hovering the mouse over a variable displays its contents.
With the availability of Microsoft's free Windows PowerShell Integrated Scripting Environment (ISE) and other free PowerShell scripting editors, a PowerShell development environment needs to offer features that go beyond basic editing and debugging. ASE offers many advanced features that go far beyond plain editing and debugging. One advanced feature that I really liked is the built-in ScriptForm Designer. Many times you want to couple your scripts with simple UI components, and the ScriptForm Designer enables you to do just that for both PowerShell and VBScript. The ScriptForm Designer can really enhance the usability of your scripts by providing them with a GUI. One of the other cool features found in ASE is the ability to package your scripts as executables. ASE also has support for code signing, as well as the ability to compare files.
Three different editions of ASE are available: the $99 Standard Edition, the $199 Professional Edition, and the $299 Enterprise Edition. The Standard Edition provides the essential editing capabilities and code-generation wizards. The Professional Edition adds debugging, script packaging, and the Logon Script Builder. The Enterprise Edition adds a script deployment console, an advanced query builder, and the ScriptForm Designer. The product doesn't have a manual, so only online help is available. You can download a fully functional 45-day trial of the ASE Enterprise Edition at www.adminscripteditor.com/editor/download.asp.
Overall, I found ASE to be an excellent PowerShell editor. Unfortunately, it wasn't compatible with Windows 7. However, ASE's real strength is in the additional tools and advanced features such as the wizards, script packager, and ScriptForm Designer.
SAPIEN's PrimalScript 2009
PrimalScript 2009 also started as a VBScript editor that SAPIEN enhanced to support PowerShell. Some of the important new features in the PrimalScript 2009 release include the Object Browser, integrated connections to MSDN and Google, an integrated command window, support for running scripts with elevated privileges, and support for Windows 7. Besides Windows 7, PrimalScript 2009 is supported on Server 2008, Windows Vista SP1, Windows Server 2003, and Windows XP SP2. The development system is recommended to have a minimum of 1GB of RAM and the .NET Framework and Windows PowerShell installed. PrimalScript 2009 provides support for 50+ languages, including PowerShell, VBScript, JScript, Windows command shell (.bat and .cmd), Visual Basic .NET, ASP.NET, Java, Adobe Flex, Perl, HTML, and XML.
Installation and Editing
Installing PrimalScript 2009 was effortless, taking less than a minute. PrimalScript provides a multi-tabbed editor, which you can see in Figure 2. I found the PrimalScript editor to be intuitive and easy to use. Its interface is very similar to that in Visual Studio, and I preferred PrimalScript's look and familiar icons over ASE's interface.
Figure 2: PrimalScript 2009's UI (click to enlarge)
PrimalScript provides a full-featured editor with unlimited undo and redo, color-coded syntax, and IntelliSense-style code completion, which is called PrimalSense. I really like PrimalScript's Clipboard Ring, which lets you copy multiple code sections to the clipboard, then choose to paste different pieces into different sections of your script.
By default, the PrimalScript editor shows line numbers. Pressing F1 while your cursor is over any of the PowerShell cmdlets displays a help pane for that cmdlet at the bottom of the PrimalScript editing window. This editor doesn't support block cut-and-paste, but it does support multi-file projects. However, I don't really care for the way projects are associated with workspaces. To me it seems like an extra and unnecessary layer. However, PrimalScript's handy Find in Files feature lets you search for a text string in multiple files, which is useful when working with multi-file projects.
Writing New Scripts
PrimalScript has a more limited set of wizards than ASE for generating new PowerShell scripts. PrimalScript provides the ADO Wizard, ADSI Wizard, Logon Script Wizard, and WMI Wizard. However, the wizards generate VBScript or JScript code but not PowerShell code. PrimalScript provides an extensive set of code snippets and samples for PowerShell and many of the other supported languages.
Running and Debugging
Running scripts in PrimalScript worked as expected. I didn't need to change any code signing settings. The output of each script was displayed in the Output window, which you can see at the bottom of Figure 2.
The debugging of PowerShell scripts with PrimalScript was basic but functional. However, I couldn't set a breakpoint by clicking in the margins like I expected to be able to. Instead, I had to toggle breakpoints using the F9 key. Running the scripts in debug mode worked well, and there were no signing errors or other issues. A Set Arguments option lets you set up command-line arguments for the scripts being debugged. The debugger allows single stepping, and the script variables' contents are displayed in a Variables window. I wasn't able to hover the mouse over a variable and see its contents, nor was I able to change its contents.
PrimalScript's advanced features were more limited than ASE's. PrimalScript provides a Script Package feature that you can use to deploy your scripts as executables. In addition, PrimalScript can be integrated with source control programs, such as Microsoft's Visual SourceSafe or SAPIEN's ChangeVue. Other useful features include built-in code signing and the ability to compare files.
Unlike previous versions of PrimalScript, which offered a bewildering array of editions, there's only one edition of PrimalScript 2009. I found this to be a welcome change. PrimalScript 2009 offers full online help, but I found many topics such as snippets were missing. A more complete manual is provided as a PDF file that's installed along with the product. You can download a fully functional 45-day trial of PrimalScript 2009 at www.primaltools.com/products/info.asp?p=PrimalScript.
Both ASE and PrimalScript are excellent, and they beat the heck out of developing PowerShell scripts with Notepad. However, the editor's choice for this comparison is PrimalScript 2009. The PrimalScript interface is more to my liking. Although it lacks the more advanced code-generation tools, PrimalScript provides project support and extensive samples, and its debugging (albeit rudimentary) is quite workable. With that said, I'm an experienced developer and have written code and scripts for years so I've workes with multiple scripting technologies and languages. Windows administrators not really familiar with Windows Management Instrumentation (WMI), Active Directory Service Interfaces (ADSI), and PowerShell would probably find ASE's wizards to be more important—as long as they don't need Windows 7 support right now.
Admin Script Editor (ASE) 3.6