Getting Started with PowerShell Studio 2012

Lately I have been getting more and more into PowerShell. Sure the most recent Tech on Tap has something to do with that. The sessions and discussion there were great and got me thinking about ways to do more with PowerShell. More on the sessions from Tech on Tap soon. I have blogged about PowerShell a few times here and on other websites, but havent had much to say about any Integrated Scripting Environments.

Sapien’s PowerShell Studio 2012 is the focus of this post.

What is PowerShell Studio?

Those who work with PowerShell regularly are probably at least a little familiar with PowerShell Studio (or other Sapien scripting tools). For those getting started with PowerShell, this product is an Integrated Scriping Environment focused on PowerShell. Sapien also makes other products, including PrimalScript (an ISE for mutiple scripting languages).

The PowerShell scripting environment in PowerShell Studio allows intellisense style code completion, which for someone learning the language is extremely useful. PowerShell itself supports tab completion, which is helpful, but the highlighting of keywords is a small feature that I find very useful. In addition, cmdlets also can display help in the bottom pane of the application.

For example, if I want to get BIOS information about the computer I am working on, I can enter the following:

get-wmiobject win32_bios

This will return the BIOS information for my computer. When I enter the cmdlet for get-wmiobject and tab to complete it, the bottom portion of the application switches to the Help tab to display the cmdlet help information as you work with it.

Console included

When working in PowerShell Studio, I still find myself pasting the code I want to test into the PowerShell console, but the ISE includes its own PowerShell host (or console). This allows code to be tested right in the application. The difference between the console in PowerShell Studio and other applications is the command window. The entry line for the console is in the application, when commands are entered they do not land right in the familiar blue console window. If I select some code in the scripting window and right click it to select run in console, the code is submitted to the included PowerShell host and run as a unit, but if I enter code on the line, each line is submitted to the console after each enter press.

In many cases I am using the help pane inside the application and still paste code selection for testing functions and other code into the PowerShell.exe provider, but the ability to select and run at the console is a feature I am getting used to.

No need to reinvent the wheel

I know that command line environments promote quick entry of code and in the case of PowerShell, hugely concatinated one liners to execute multiple actions together, but in PowerShell Studio (and other ISEs I am sure) things that are used frequently are stored as snippets.

A snippet is a reusable piece of code designed to make things easier and save typing. In addition to the included snippets the library is customizable. if there is a piece of code written that might be useful for future use the code can be stored as a snippet to make it easier to use. My favorite snippet thus far is the comment help item which inserts a template for creating comment based help within a script or function.

More than just a script editor

PowerShell Studio’s editor is a solid experience, but it is not the only thing that makes this ISE a good choice. Many Microsoft applications, including Exchange 2010 are beginning to build their UI on top of PowerShell. When commands are entered into the GUI, the actions take place in PowerShell under the hood. PowerShell Studio allows the creation of forms which use PowerShell under the hood. This is a feature or use I am still getting used to and learning how to operate. Once I get a better understanding of how it works there will likely be more blog posts on that particular feature.

Bulding GUI forms to run on top of a PowerShell script makes a lot of sense to me, consider a script for resetting the account password for an AD user. Creating a form where I can enter a user ID and a temporary password and click a button to trigger the script will allow me to deliver an application to a help desk user or another co-worker which they can use to handle to duty of password resets.

To share forms applications with other users, PowerShell will be needed on the target machine and using the built in Script packager which configures the needed components into an executable file that can be run from another computer.

Support for PowerShell v 3

PowerShell Studio has already been updated to support PowerShell v 3. Other ISEs that I have tried are not PowerShell v3 ready, or at least arent as far as I can find, but more there in another post.

First impressions overall

Being someone who likes a little extra help, with things like syntax highlighting and snippets, PowerShell Studio is a really solid environment. I know that PowerShell has its own ISE from Microsoft so no third party applications are necessary, but the included ISE from Microsoft just doesnt feel as solid. I do hope the Microsoft ISE grows with PowerShell, but for now I will take a third party environment. Out of those I have tested PowerShell Studio is my favorite so far. As I write more scripts and forms there will be more blogging for sure.