The information in this article was written against the Community Technology Preview (CTP) of Windows PowerShell 2.0. This information is subject to change in future releases of Windows PowerShell 2.0.
| Windows PowerShell 2.0 (Community Technology Preview) | |
| Should I Download and Install Windows PowerShell 2.0? | |
| What’s New in Windows PowerShell 2.0? | |
| How Can I Learn More About Windows PowerShell 2.0? |
If you haven’t heard yet, then let the Scripting Guys be the first to tell you: a new version of Windows PowerShell -- Version 2.0, the November 2007 Community Technology Preview (CTP)– is now available for downloading and installing. Needless to say, that leads to at least two important questions: 1) what’s in this new release of Windows PowerShell, and 2) should I download and install this new release of Windows PowerShell? We’ll explore the first question (what’s in PowerShell 2.0) in more detail in just a moment. Before we do that, however, let’s talk about the second question: should you download and install Windows PowerShell 2.0?
The answer to that question is this: yes, you should download and install Windows PowerShell 2.0. However, this is a somewhat qualified “yes.” After all, a CTP release is just a fancy term for “pre-beta release.” PowerShell 2.0 is still very much early beta software. In fact, technically it doesn’t even qualify as a beta: the feature set is far from complete, there are a few bugs here and there, and there will likely be a large number of changes between now and the time of the official release of Windows PowerShell 2.0. If nothing else, that means you might want to think twice before downloading and installing the CTP release on all your computers, and making PowerShell 2.0 your automation standard. As the PowerShell team itself says, “The functions delivered in CTP WILL CHANGE.”
You can’t get much more emphatic than that.
On the other hand, the Scripting Guys have been playing with PowerShell 2.0 for a little while, and we have yet to encounter any truly serious problems; most of the new features seem to work as advertised. On top of that, some of these new features are pretty slick. The bottom line? We believe it’s well worth your while to download and install PowerShell 2.0 on a computer or two (maybe a test computer to begin with). Play around with PowerShell 2.0, learn how to use the new features and new cmdlets, and then make a decision about using it more broadly. And remember, PowerShell is the future of scripting and automation for Windows; that means it’s never too early to start learning what you can and cannot do with the technology. PowerShell 2.0 is a good place to start that educational process.
OK, we admit it: that’s a somewhat cursory answer to the question, “Should I download and install PowerShell 2.0?” After all, there are other things to take into consideration. For example, PowerShell 2.0 and PowerShell 1.0 cannot run simultaneously on the same computer; before you can install PowerShell 2.0 you’ll have to uninstall 1.0. Will that be a problem for you? That’s a question we can’t answer. PowerShell 2.0 does include remoting, but you’ll have to install and configure Windows Remote Management (WinRM) as well. Will that be a problem for you? Again, that’s a question we can’t answer. To a certain extent, you’re on your own here.
Note. For a detailed discussion of these issues (and more), take a peek at the Windows PowerShell team blog. |
Oh, what the heck: here’s what we really think. As a system administrator or IT professional, you need to download and install Windows PowerShell 2.0 and start learning how it works. Your users can probably live without it for awhile longer.
So what is new in Windows PowerShell 2.0? Good question; how much time do you have? As it turns out, there’s a ton of new features in PowerShell 2.0. Here are some of the highlights:
Remoting
This is the one everyone has been waiting for: the ability to run PowerShell commands against remote computers. And don’t worry: PowerShell’s remoting relies on WinRM, which means that the data transmissions are encrypted and secure. That also means that PowerShell’s remote sessions are firewall-friendly, enabling you to safely manage computers across the Internet.
New (and Improved) WMI Cmdlets
Next to remoting, the new (and improved) WMI cmdlets might prove to be the most interesting to system administrators. To begin with, the Get-WMIObject cmdlet has been enhanced, enabling you to specify settings like the DCOM authentication and impersonation levels; among other things, that allows you to manage IIS 6.0 servers using WMI and Windows PowerShell. (With PowerShell 1.0 you have to use a fairly complicated .NET Framework script to manage IIS 6.0.) In addition there are three new cmdlets that make it easier to work with WMI objects, methods, and properties:
| • | Invoke-WMIMethod |
| • | Remove-WMIObject |
| • | Set-WMIInstance |
Definitely worth a look.
Script Debugging
PowerShell 2.0 includes a cmdlet-based debugger built right into the scripting environment; that means you can do such things as set breakpoints and step into and out of scripts using the PowerShell console window itself. (That is, without needing to use a specialized script editor or development environment.) And trust us: this is way cooler (and way more useful) than it might first sound.
Background Jobs
Each time you issue a command in PowerShell 1.0 you have to wait until that command finishes before you can do anything else. That doesn’t have to be the case with PowerShell 2.0: in PowerShell 2.0 you can configure commands to run as asynchronous background jobs. What does that mean? That means that as soon as you start one of these jobs the PowerShell command prompt is immediately returned to you and you can continue with other tasks. All the while, your background jobs continue to run in the, well, background.
And yes, you can create multiple background jobs, and create background jobs that run against multiple computers. Needless to say, this has the potential to make your system automation tasks even faster and more efficient.
Graphical PowerShell
It’s an “early alpha” version, but Graphical PowerShell provides a graphical environment for creating, editing, and running PowerShell scripts. Only a handful of features have been enabled for this initial version, but those features are pretty cool: color-coding; line numbers; a multiple document interface; and the ability to run both scripts and PowerShell commands within the same application window. If you think that PowerShell is only for command-line junkies, well, someday soon you might need to think again. (Hopefully you’re not like the Scripting Guys; we always dread the prospect of having to think again.)
Cmdlets: Something Old and Something New
As we noted earlier, the Get-WMIObject cmdlet has been enhanced in version 2.0. That’s true for other cmdlets as well, including Get-Member, Invoke-Expression, and Select-String. Oh, and there are also some cool new cmdlets like Out-GridView, which provides a remarkably easy way to display data in a dynamic grid. What’s a dynamic grid? It’s a grid that, among other things, allows you to resize columns, sort data, and filter and group data.
By the way, Out-Gridview is very cool.
ScriptCmdlets
Want to write a cmdlet for Windows PowerShell 1.0? No problem … as long as you know C#, Visual Basic .NET, or another .NET language. Want to write a cmdlet for Windows PowerShell 2.0? No problem.
No, no disclaimer, qualifier, or caveat: it really is no problem to write cmdlets for PowerShell 2.0. That’s because you can write PowerShell cmdlets using the PowerShell scripting language. As the help documentation says, “Anyone who can write a Windows PowerShell script or function can now write and share their own cmdlets.”
For starters, come back to the Script Center on Monday, November 12, 2007. On that day, and as part of TechEd IT Forum Week, the Scripting Guys will post a number of articles introducing many of the new features in PowerShell 2.0. In addition, we’ll also be releasing an updated version of our Windows PowerShell Graphical Help File, a version including help topics for all the new features and cmdlets. In effect, that means you can get a copy of PowerShell 2.0 help and familiarize yourself with all the capabilities, even if you aren’t ready to download and install the application just yet.