PowerShell Environment Roundup: SAPIEN PrimalScript
SAPIEN's PrimalScript is one of the most venerable commercial script editors out there, having been around for… oh, about forever. The company's been around long enough, in fact, to expand into book publishing (sapienpress.com) and training (scriptingtraining.com). PrimalScript 2009 retails for $300; for $540 you can get a "Studio" package that includes a SQL tool, file merge/compare tool, standalone debugger, source control system, XML editor, and PowerShell GUI builder. A cool $1000 nabs you all that plus a handful of eBooks, video training, and so on. Get the full writeup at http://windowsitpro.com/go/donjonespowershell .
June 2, 2010
PowerShell Environment Roundup: SAPIEN PrimalScript
This is the first in a series of reviews of major PowerShell commercial script editors; this is pretty lengthy (it's meant to be comprehensive), so grab a cup of coffee before you dive in.
For this series of reviews, I developed a standard criteria against which I evaluated each product. You'll see me referring to sections of that criteria within each review; the criteria is mainly intended to help me stay objective, and to make sure I'm covering each product equally in terms of features.
SAPIEN's PrimalScript is one of the most venerable commercial script editors out there, having been around for… oh, about forever. The company's been around long enough, in fact, to expand into book publishing (sapienpress.com) and training (scriptingtraining.com). PrimalScript 2009 retails for $300; for $540 you can get a "Studio" package that includes a SQL tool, file merge/compare tool, standalone debugger, source control system, XML editor, and PowerShell GUI builder. A cool $1000 nabs you all that plus a handful of eBooks, video training, and so on.
Full disclosure: Many of you may be aware that I used to be employed by SAPIEN; in fact, most of their video training titles were my work, as are a couple of the books. I've not been employed by them since mid-2008. SAPIEN provided me with free copies of their software for this review, and they still hires me from time to time to teach instructor-led PowerShell classes.
PrimalScript's biggest claim to fame is its breadth of scripting language support: Some 40-odd programming languages, in all, are supported to some degree or another. For this review, we'll look solely at the PowerShell-related features and support. Bear the other languages in mind, though; if you're still working in VBScript or occasionally need - I don't know, HTML or XML or ActionScript or something - PrimalScript is one of the few commercial options out that that can carry you through (note that this series of reviews is focused on commercial tools, rather than free ones, since most folks are well aware of the free options and frankly aren't risking anything by procuring one).
Let's begin with core editing features. PrimalScript supports syntax highlighting, meaning it color-codes commands, variables, and so forth, making complex scripts a bit easier to read. It supports auto-indentation that help keep constructs neatly formatted, and it has all the basic copy/edit/paste/undo functions you'd expect. Its Undo is actually a standout feature: Undo information is stored in a separate filestream, along with the file (provided it's on an NTFS partition), so you can continue undoing mistakes from far in the past as soon as you re-open a file. Live syntax checking for PowerShell is supported, meaning you'll get a Word-like red broken underline when the editor thinks you have a syntax error.
"Code hinting" is present in the form of pop-up tool tips that display when you hover over a cmdlet name; a problem with these is that they don't word-wrap, meaning any reasonably-long cmdlet syntax (like Get-WmiObject) scrolls off-screen. When you're actually typing the command (as opposed to hovering over it), you do get a nicely-formatted, word-wrapped pop-up syntax reminder. "Code completion," those "IntelliSense-like" pop-up menus that can finish typing a cmdlet for you, works well for cmdlets as well as parameters. It does not provide code-completion for file paths and filenames, something other editors do that I actually find annoying and distracting. "Code folding" is also supported: This is the ability to "collapse" a section of code, like an entire function, so that it's hidden from view. That can be useful when working on a long script. There's also dynamic help, which brings up help for a cmdlet in a separate docked or floating pane.
I have two nitpicks with the software's code completion: First, if you type "Get-WmiObject," it's happy to prompt you with possible parameters. However, if you type the alias "gwmi," you don't get parameter assistance. Second, it's not aware of parameter sets. That is, if I've already used the -recurse parameter with Get-WmiObject, I shouldn't be offered the -filter parameter, since it isn't present in the parameter set that includes -recurse.
Brace matching is the one feature I wish was very slightly stronger. This feature is designed to highlight matching pairs of braces or other punctuation, so that you know you have a matched set. I don't quite understand the logic behind PrimalScript's implementation; it seems to highlight braces when you move the cursor before the opening brace, and after the closing brace - but only if the closing brace has a space or character in front of it, meaning it won't match if you move your cursor in front of a closing brace that's on a line by itself.
There are also numerous extra features, like my favorite: The ability to go through a script and convert all aliases to their full cmdlet names, making it easier to share the script with others and making long-term maintenance easier. I wish it did the same thing for parameter names, but it doesn't. Overall, then, PrimalScript gets 4.5 stars out of 5 for editing features.
In the category of "helping you get things done faster," PrimalScript has a WMI, ADSI, and Logon Script Wizard, but unfortunately none of them produce PowerShell code at this time. PrimalScript does provide a Snippets feature: Youc an type the name of a Snippet and press Ctrl+J to get the full snippet in your script, or you can drag snippets from a tree view browser. You can also highlight any block of code and right-click to create your own snippet. The included snippets include ADSI, database, and WMI selections, along with basic language constructs. Interestingly, there's also a "VBScript to PowerShell" set of snippets: Type a VBScript keyword and press Ctrl+J to see the PowerShell equivalent. There's no integration with online code repositories such as PoshCode.org. In this category, PrimalScript gets 2 stars out of 5, mainly on the strength of the included snippets.
In the "Packaging and Distribution" arena, PrimalScript includes a full script packager that can create semi-independent EXEs from your scripts (PowerShell still needs to be present for the EXE to run). You get a pretty granular level of control over the final executable, including custom manifests, icons, and the ability to bundle additional support files. It can also run your script under alternate credentials, which are encrypted and stored within the package. PrimalScript also supports .psd1 and .psm1 files, although in the build I used it did not activate PowerShell syntax support for .psm1 Script Module files; it was easy for me to add the .psm1 file extension in the tool's options, and I suspect a future build will include that as a default. In this category, 5 stars out of 5, with a minor wish that the flexibility of the script packager didn't make it seem so complex - you almost want a wizard for it when you're just trying to quickly pump out an EXE.
Now for "Integration." PrimalScript has a robust database browser, and can execute SQL queries and display their results, all within the product - very useful when you're working with database-centric scripts. There's a basic graphic WMI browser (hidden in the generic "Object Browser" panel), although frankly SAPIEN has a far superior "WMI Explorer" tool that's free from www.primaltools.com (click on "Community Downloads"). There's a built-in FTP client, and built-in support for XML files (which PowerShell makes heavy use of for its own configuration files). Although not configured to use PowerShell by default, you can easily change the "Comamnd Window" docked/floating pane to use PowerShell, so you get an in-editor interactive command-line. However, I noticed that that command window doesn't scroll automatically, which means you're constantly reaching for the scroll bar to bring the prompt back into view - that's a definite downside. Still, tor integration, PrimalScript gets 4.5 stars.
A caveat with that: Unlike most other editors, PrimalScript maintains a separate runspace for scripts and for that interactive command-line window. That is, loading a module in the command-line window doesn't make that module available to whatever script's you're writing. Each time you run a script, in fact, that script gets an all-new runspace. I don't consider this behavior to be either good or bad; it just is. There are pros and cons to this and other approaches, and every administrator will likely have a strong opinion of how they prefer it to work.
For "Remote Management," however, I have to give PrimalScript 0 stars, as it provides no inbuilt support for PowerShell remoting. That's a shame. The tool does have a "Remote Script" function, but that depends on a SAPIEN-provided service being installed on the remote machines, and seems to only work for Windows Script Host scripts. I'd like to see that extended to support PowerShell, using v2's built-in remoting.
Now for "Advanced Features." PrimalScript does not include a visual forms builder, although one is included in the "Studio" and "Universal" bundles, and is available for standalone purchase. PrimalForms, as it's called, kicks butt. It even has lightweight editing capabilities that surpass Microsoft's own ISE, while giving you a Visual Studio-like forms-building and -coding experience. Combined with the ability to package scripts into EXEs, it rocks - and it can send scripts to PrimalScript for more intensive editing. There's also built-in source control connectivity to CSV/Subversion as well as any Microsoft SourceSafe-compatible system, as well as SAPIEN's own ChangeVue system. Finally, there's a full visual file comparison/diff tool, although the add-on PrimalDiff product provides far superior functionality. 5 stars.
In the "PowerShell Environment / Security" category, PrimalScript does well. It offers full support for applying digital signatures to scripts, including the ability to sign scripts automatically upon saving them. It provides control over the shell's execution policy. It also loads your PowerShell profile script, which is a great way to make sure any PSSnapins or modules are available for your scripts. I wish it actually had a dialog box that let you specify which snap-ins and/or modules to load, rather than making you have a profile script for that purpose. However, the profile script approach does help it more closely emulate a "standalone" PowerShell environment, where you're just opening the shell on its own and relying on what's in your profile script. PrimalScript does not, as described earlier, support multiple runspaces: Each tab in the editor is a script, and gets a fresh runspace each time you run it. 4.5 stars, here.
Now for the "Debugging" category. PrimalScript offers a full visual debugger, and in my quick tests didn't have any problems with any script I threw at it. You can manage breakpoints by clicking in a side margin area, and you get a full visual breakdown of all defined variables and their values whenever the script is paused. You don't get an "immediate window," meaning the ability to execute commands while in suspend mode. That's something both PowerShell's console and ISE do give you, and it'd be a nice feature for a future version. You also have the ability to highlight one or more lines and just execute those lines - a handy way to test code. You can't, however, do this with a shortcut key (at least not by default) as you can in the ISE. That's a shortcoming, because it places the final hurdle in the way of using PrimalScript as a combo editor/interactive tool; I'd like to see a default keyboard shortcut a la the ISE. 4 stars, because the debugger seems rock-solid, although the lack of fast and easy access to "run one line at a time" is a shortcoming.
For the "Overall" competition. PrimalScript's UI is very Visual Studio-like. You can select from several color schemes, but it's a very traditional toolbar-and-pane based environment. Some will like that; I think it's great for advanced users, but intimidating for new ones. So much of the UI isn't useful for PowerShell, for example, that you get a lot of grayed-out options on a lot of menus, which is just wasted space. You can configure and save workspaces, so with some time you can create a pretty custom layout and have that pop up whenever you like. In terms of customization, the sky's the limit: You can maneuver docking panes to the top, left, right, or bottom of the main window, and can split the main editor in two either vertically or horizontally. Docked panes can be floated, as well, which is useful if you have a large monitor or multiple monitors. PrimalScript even provides separate output tabs for normal script output and for debugger (Write-Debug) output, which is tremendously useful. In this category, 4 stars out of 5 - I'd like to see the option for a more trimmed-down interface for someone just working in PowerShell. I think the UI, as it is, is very complete and sophisticated - but it's overwhelming for administrators who don't have a scripting background, almost as much as Visual Studio would be. Some folks might prefer a ribbon-style UI, but I'm not including that in the rating because I know just as many people hate that kind of UI.
Finally, the last rating is "How well does this completely replace PowerShell's console and ISE?" That is, could you ever use PrimalScript completely in lieu of Microsoft's two interfaces? I don't think so, and for that reason PrimalScript gets just 1 star out of 5. True, you can have the PowerShell console in a pane - but that's not replacing Microsoft's console, it's embedding Microsoft's console. That pane doesn't integrate in any other way with the rest of the tool: There's no code hinting or completion in it, for example. PrimalScript is an editing/debugging environment first and foremost; it is not geared for use as an interactive shell. This is unfortunately a major shortcoming given that many administrators are looking for a stronger SHELL experience that integrates script editing capabilities; PrimalScript's focus is as a SCRIPTING environment that integrates a shell for convenience.
Out of 50 stars total, PrimalScript earned 34.5, or 69%. Key weaknesses mainly revolve around the tool's use as an interactive shell replacement, and to be fair, when PrimalScript was invented there was no reason for it to be such a thing. The way PowerShell blurs the line between "scripting" and "shell" is challenging for more mature products like PrimalScript. If you're mainly a scripter, you'll find that the software's maturity brings you a wealth of features - plus the bonus of support for languages like VBScript, JScript, and so on, all in the same package, and all with the same toolset. The wealth of add-in tools for SQL, XML, file compare, source control, and so on make for a truly complete package, if you can afford the sticker price. The additional availability of training, video training, and books suggests that SAPIEN is really focused on this market - and indeed, they don't make any products that don't have something to do with scripting.
PrimalScript's license is generous, allowing you to install it on multiple computers that you own or use - so you can have it on your desktop as well as your laptop, for a single price.
Also note that PrimalScript is updated VERY frequently - in fact, as I was closing out this article, a new update has been posted that promises to fix a couple of the shortcomings I've noted here, including the integration of PowerShell remoting in their Remote Script Execution, and the problem I noted with brace matching.
Also note that - like with most tools of this nature - your personal habits and needs will really determine what's best for you. PrimalScript is available in a 45-day trial, and the other editors I'll be reviewing are also available in free trials; your best bet is to try 'em.
My next review will be Idera's PowerShell Plus, which is a younger and somewhat more hybrid-style of PowerShell editor. We'll see how it fares.
Want more PowerShell articles, along with FAQs and more? Visit http://windowsitpro.com/go/DonJonesPowerShell.
About the Author
You May Also Like