Shell power for Windows
Over the past few years, Microsoft has been quietly building a next-generation administrative shell product codenamed Monad. Now launched with the more formal name PowerShell, this product is in late beta, and a release candidate was delivered at the MMC Summit in April. PowerShell will ship as part of both Exchange 2007 and MOM 3 (now renamed System Center Operations Manager 2007), and in the WinFX SDK towards the end of this year. You can get PowerShell RC1 for 32- and 64-bit CPUs from the Microsoft website, which requires a mandatory registration using Passport. Pick up the documentation pack too. To run PowerShell, you first need to install .NET Framework 2, which you can also download (I’ve put links to all the needed bits on www.reskit.net and I’ll keep these up to date as the launch approaches).
I have to wonder at the folks who name Microsoft’s products: “PowerShell” sounds like a throwback to some freeware add-on for Windows 3.11, while Googling reveals that it’s already being used for two other existing products. For reasons understood only in Redmond, PowerShell won’t be shipping in Vista, even though it would run just fine.
However, despite Microsoft’s Department of Mindless Marketing Names doing its worst, PowerShell is a fantastic product that most IT professionals are going to love – you’ll be reading a lot more about it over the coming months (and years). It’s a very cool product in several ways that I could spend days discussing – and no doubt will be doing in due course – but I’ll leave a general survey of its features to other PC Pro writers and other forums. The relevance of PowerShell to this particular column is that it’s built on top of – and fully exposes – the .NET Framework for use from a command line.
Why a new command shell?
PowerShell is a new administration shell and scripting tool, aimed at administrators who manage computer systems. It provides a highly interactive command shell, on a par with the C-shell or Bourne shell under Linux/Unix. It also supports a rich programming language with features that rival Perl or Ruby, with a focus on administration and job control.
At the heart of PowerShell is the interactive command shell, which looks superficially much like cmd.exe, as you can see in the screenshot on the right. At the shell prompt, you can run either interactive commands or prewritten scripts, similar to the way you ran BAT or CMD files under cmd.exe.
The history of Microsoft’s administrative management tools is patchy and inconsistent, beginning with cmd.exe on NT combined with a few GUI-based tools from Microsoft and others. Then we got VBScript and WMI, and finally along with Windows 2000 came the Microsoft Management Console (MMC). None of these tools were properly aimed at administrators, nor were they particularly powerful (even VBScript has its limits). Unix/Linux admins by contrast have always had a wealth of powerful tools to assist them.
Unix’s pipe construct has always been at the heart of its management tools, and PowerShell introduces the full power of pipes to Windows, except that rather than piping only raw text – as Unix does – it can pipe rich .NET objects. This means the receiving function at the end of the pipe knows precisely what it’s been passed (no more faith-based parsing of raw text), while the objects exposed by PowerShell allow you to access their properties and methods directly in a consistent fashion.