Martin Heller
Contributing Writer

Windows PowerShell: An Introduction

analysis
Apr 16, 20074 mins

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

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.
Martin Heller

Martin Heller is a contributing writer at InfoWorld. Formerly a web and Windows programming consultant, he developed databases, software, and websites from his office in Andover, Massachusetts, from 1986 to 2010. From 2010 to August of 2012, Martin was vice president of technology and education at Alpha Software. From March 2013 to January 2014, he was chairman of Tubifi, maker of a cloud-based video editor, having previously served as CEO.

Martin is the author or co-author of nearly a dozen PC software packages and half a dozen Web applications. He is also the author of several books on Windows programming. As a consultant, Martin has worked with companies of all sizes to design, develop, improve, and/or debug Windows, web, and database applications, and has performed strategic business consulting for high-tech corporations ranging from tiny to Fortune 100 and from local to multinational.

Martin’s specialties include programming languages C++, Python, C#, JavaScript, and SQL, and databases PostgreSQL, MySQL, Microsoft SQL Server, Oracle Database, Google Cloud Spanner, CockroachDB, MongoDB, Cassandra, and Couchbase. He writes about software development, data management, analytics, AI, and machine learning, contributing technology analyses, explainers, how-to articles, and hands-on reviews of software development tools, data platforms, AI models, machine learning libraries, and much more.

More from this author