Okay, I might be exaggerating when I say that the upcoming version of PowerShell, Microsoft's robust and ubiquitous scripting language, will bring scripting to 2015, but PowerShell 3.0 will certainly bring a whole lot to the table for both hardcore programmers as well as casual scripters. Personally, I fall somewhere in the middle and I'm pretty excited about what I see coming.
First of all, PowerShell 3.0 is included in the Windows Management Framework 3.0 CTP2, which is available for download and installation on Windows 7 SP1 and Windows Server 2008 R2 SP1 machines. Now that you know where to get it, make sure you understand that "CTP" stands for Community Technology Preview. This is pre-alpha stuff. It's from beta. It's intended to be exactly what it says... a preview. Don't expect a finished product and certainly don't expect something that is free of potential problems. You shouldn't install the CTP version to a machine that you depend on for critical, time-sensitive PowerShell scripting. I installed the CTP2 to a test virtual machine. In order to do so, I needed to make sure that the machine was running Windows 7 SP1 or Windows Server 2008 R2 SP1. Further, CTP2 requires the installation of the .NET Framework 4.0.Once you have the prerequisites in place, you can install the package. To make sure everything has gone as planned, open PowerShell after installation and run the command $host.version. You will get a result like the one shown in Figure A, which shows you that PowerShell 3.0 is installed.
PowerShell 3.0 is installed
Before I show you a couple of pretty cool capabilities in PowerShell 3.0, let's take a look at what Microsoft is saying they're including in this newest version. From the Windows Management Framework 3.0 - Community Technology Preview (CTP) #2 page, here are some of the new features in Windows PowerShell 3.0:
- Workflows: Workflows that run long-running activities (in sequence or in parallel) to perform complex, larger management tasks, such as multi-machine application provisioning. Using the Windows Workflow Foundation at the command line, Windows PowerShell workflows are repeatable, parallelizable, interruptible, and recoverable.
- Robust Sessions: Robust sessions that automatically recover from network failures and interruptions and allow you to disconnect from the session, shut down the computer, and reconnect from a different computer without interrupting the task.
- Scheduled Jobs: Scheduled jobs that run regularly or in response to an event.
- Delegated Administration: Commands that can be executed with a delegated set of credentials so users with limited permissions can run critical jobs
- Simplified Language Syntax: Simplified language syntax that make commands and scripts look a lot less like code and a lot more like natural language.
- Cmdlet Discovery: Improved cmdlet discovery and automatic module loading that make it easier to find and run any of the cmdlets installed on your computer.
- Show-Command: Show-Command, a cmdlet and ISE Add-On that helps users find the right cmdlet, view its parameters in a dialog box, and run it.
I'm not going to focus here on the behind-the-scenes stuff; I'll instead focus on a couple of features that will make life easier for both new and experienced PowerShell scripters.
Some features require the use of the PowerShell Integrated Scripting Environment (ISE), which can be installed as a feature from Server Manager as shown below in Figure B.
Install the PowerShell ISE tool from Server ManagerPerhaps one of the most useful features added to PowerShell 3.0 is a great new Show-Command cmdlet, which leverages the aforementioned ISE tool in a way that makes it much, much easier to locate commands and understand required and optional parameters. Shown in Figure C, note that you can search for a command, select it, and be shown all of the parameters that are necessary and optional. The required parameters have an asterisk next to them. You can also make use of PowerShell's Confirm and WhatIf capabilities right from this window.
The Show-Command windowThe next feature isn't really new, but has been made even better in PowerShell 3. The out-gridview parameter is shown in Figure D. With this, you can overcome PowerShell's text-based limitations and display tabular results in a graphical grid-based view, which allow you to adjust column size, add parameters and more. In Figure D, note that I've added two parameters at the top of the window. I can use these to narrow the displayed results. When necessary, I can then just click the X next to a parameter to remove it from the grid. The command that I used in Figure D is get-process | out-gridview.
PowerShell's grid view feature
These two user-facing features are just the tip of the iceberg when it comes to new ways that PowerShell can be used to ease administrative burden. Between these and the behind the scenes features, such as workflows and robust sessions, Microsoft has really taken PowerShell to a whole new level.
Since 1994, Scott Lowe has been providing technology solutions to a variety of organizations. After spending 10 years in multiple CIO roles, Scott is now an independent consultant, blogger, author, owner of The 1610 Group, and a Senior IT Executive with CampusWorks, Inc. Scott is available for consulting, writing, and speaking engagements and can be reached at email@example.com.