Free Newsletters

   All InfoWorld Newsletters
Strategic Developer | Martin Heller » Windows PowerShell: An Introduction

April 16, 2007 | Comments: (0)

Windows PowerShell: An Introduction

One of the hazards that Microsoft groups face when they launch their products is competition for attention from other Microsoft groups with bigger marketing budgets. Think about the poor Windows PowerShell team, who basically launched at about the same time as Windows Vista and Office 2007. It was no contest.

If you haven't already heard about Windows PowerShell by that name, you may have heard of it by its rather pretentious code name, Monad, or its temporary name Microsoft Shell, abbreviated MSH. I'm sure that Jeffrey Snover and the PowerShell team wanted "Monad" to convey the unified interface they were building.

Then why do I think Monad was a pretentious choice? It's the other meanings of the term. In philosophy, the term Monad, meaning the "ultimate, indivisible unit" goes back to Pythagoras, and was used by Plato, Aristotle, the neo-Platonists, Liebniz, and the Theosophists to describe some rather lofty concepts, often verging on the divine. In mathematics, a monad is a type of functor in category theory. In functional programming languages, for example Haskell, a monad is a rather complicated implementation of sequential functors.

So, what is Windows PowerShell? It's a command line shell, a programming language, and a unified interface; it's not your father's command line shell. From the Windows PowerShell Getting Started Guide:

Windows PowerShell is a new Windows command-line shell designed especially for system administrators. The shell includes an interactive prompt and a scripting environment that can be used independently or in combination.

Unlike most shells, which accept and return text, Windows PowerShell is built on top of the .NET common language runtime (CLR) and the .NET Framework, and accepts and returns .NET objects. This fundamental change in the environment brings entirely new tools and methods to the management and configuration of Windows.

Windows PowerShell introduces the concept of a cmdlet (pronounced "command-let"), a simple, single-function command-line tool built into the shell. You can use each cmdlet separately, but their power is realized when you use these simple tools in combination to perform complex tasks. Windows PowerShell includes more than one hundred basic core cmdlets, and you can write your own cmdlets and share them with other users.

Like many shells, Windows PowerShell gives you access to the file system on the computer. In addition, Windows PowerShell providers enable you to access other data stores, such as the registry and the digital signature certificate stores, as easily as you access the file system.

I have found PowerShell to be extremely useful for exploring the operating system. One of the data stores it supports is WMI, Windows Management Instrumentation, which is a wrapper for many system structures, so you can use PowerShell to dig into the guts of things like Win32 processes, add-remove program lists, and system hardware. It also supports COM, so you can use it to script all sorts of applications and controls that expose COM interfaces.

I was under the mistaken impression that PowerShell would ship with Windows Vista. In fact, you need to download and install PowerShell separately; make sure that you get the right version for your operating system (Vista, XP, Windows Server 2003, or Longhorn Server) and locale, and that you have .NET Framework 2.0 installed before you install PowerShell.

Windows PowerShell in Action The documentation that comes with the Windows PowerShell download will get you started. However, I have found Windows PowerShell in Action, by Bruce Payette (Manning, 2007, 576 pp, ISBN 1-932394-90-7, $44.99) to be an excellent supplement. Payette is a co-designer of the PowerShell language and the principal author of the language implementation. His book not only tells you all the secrets of PowerShell, it tells you what the team was thinking when they designed and implemented the language.

Posted by Martin Heller on April 16, 2007 06:00 AM


RATE THIS ARTICLE:





 

  •  
  • COMMENTS




Martin:

I am curious to see what would be the result of using our software, i.e. ActiveWords to name the scripts that you create in PowerShell?

I met with the PowerShell team awhile back, but didn't get a lot of traction.

Buzz Bruggeman

Posted by: Buzz Bruggeman at April 19, 2007 10:44 AM

PowerShell is a free download. Why don't you try it out?

Posted by: Martin at April 19, 2007 11:50 AM

A command box is an feature that has existed in Microsoft Visual FoxPro since 1992. This is a 15 year effort on Microsoft's part to recreate that same functionality in their other programming related products. And, now that they have finally reached this accomplishment, they are planning to kill Visual FoxPro, as it always has and still does make their other products look bad in terms of developer interface and usability and product performance.

Posted by: RBROOKU at April 19, 2007 02:02 PM

Technology White Papers

 

InfoWorld Technology Marketplace

» Technology White Papers Library

Technology White Papers by Topic

Technology White Papers E-mail Alert

Find out when the latest white paper is available:
 
 
» BUY A LINK NOW

Sponsored Technology Links