PowerShell

PowerShell is an object-based shell. Imagine a Unix shell (bash, Korn shell, etc.) that passes around .NET objects.

In many ways, PowerShell is a best-of-both-worlds synthesis of Windows and Unix culture. It was developed at Microsoft by former Unix developers. The core of the PowerShell language is based on the IEEE POSIX 1003.2 standard for Unix shells. But where Unix shells pipe text between commands, PowerShell passes .NET objects. That means instead of having to tease apart text to extract the information you want, you can simply access methods and properties of objects. It takes a while to realize just how powerful this is.

Because PowerShell is built on .NET, you can access the full functionality of the .NET framework from PowerShell just as you would from C# or VB.NET. But in addition, PowerShell wraps previous Microsoft object models such as COM and WMI in a consistent way so you can mix these objects together without paying a great deal of attention to where the objects originated.

PowerShell is duct tape extraordinaire. It does an awful lot of work behind the scenes to make various pieces fit together seamlessly. If you were to rewrite a typical PowerShell script in C#, for example, you'd realize how much tedious munging PowerShell is doing for you.

PowerShell is extremely consistent. For example, the basic building blocks of functionality, called "cmdlets", follow a strict verb-dash-noun naming convention: get-member, stop-process, format-table, etc. As another example, PowerShell collections simply have a length property. You don't have to remember whether particular objects use length, size, or count to say how big they are.

PowerShell provides aliases to help people coming from DOS or Unix get started. For example, you can list the files in a directory with dir or ls. Both are aliases for the get-childitem cmdlet. (Why such an awkward name as "get-childitem"? It goes back to consistency. The get-childitem cmdlet is used for navigating every hierarchical collection, whether it's the file system, the Windows registry, etc.)

PowerShell is both a shell and a programming language. As Joel Bennett put it, some people see PowerShell as bash for .NET and others see it as Perl for .NET. These correspond roughly to the system administrator and programmer perspectives. While PowerShell is a powerful scripting language, it helps to remember that it's first of all a shell. That helps explain some language design decisions that would seem mysterious otherwise. For example, why on earth does PowerShell use -lt and -gt instead of the symbols < and > to compare two numbers? Because both Windows and Unix tradition dictates that < and > are used in shells as redirection operators.

Although PowerShell is a Microsoft project, there is an open source counterpart Pash to make cross platform version by building on top of Mono.

Resources

To learn more about PowerShell, pick your media.

Blog The PowerShell development team blog
Book Windows PowerShell in Action
Booklet PowerShell Day 1
Community PowerShellCommunity.org
Podcast PowerScripting podcast
Newsgroup     Windows PowerShell newsgroup
Video Windows PowerShell: Origin and Future