Sunday, February 14, 2010

Web Development: Windows PowerShell in Plain English

Microsoft Windows PowerShell™ 2.0 is an extensible automation engine, consisting of a command-line environment and scripting language designed especially for local and remote system administration by IT professionals and power users.

Simple built-in commands called cmdlets (pronounced "commandlets"), each a specialized .NET class, perform common system administration tasks such as managing the registry, services, processes, or event logs. More than a hundred cmdlets are provided with PowerShell; and the user can develop and extend cmdlets, as well. Cmdlets can be scripted and chained such that the output from one can be used as the input to another, providing the ability to accomplish very complex tasks. The PowerShell scripting language is consistent with higher-level languages used in .NET Framework programming, such as C#.

cmdlet names consist of a verb and noun separated by a dash (-), such as Get-Process and Start-Service. The "get" cmdlets retrieve data, the "set" cmdlets establish or change data, "format" cmdlets format data, and "out" cmdlets direct the output to a specified destination. Each cmdlet has a help file that you can access by typing: get-help <cmdlet-name>.

PowerShell provides access to the file system, and ships with providers that enable access to data stores such as the registry and digital signature certificate stores by means of the same techniques used to interact with the file system. PowerShell also enables access to the COM and Windows Management Instrumentation (WMI) subsystems.

Unlike command-line environments such as cmd.exe and Unix shells, PowerShell accepts and returns .NET objects rather than text, bringing new tools and techniques to the management and configuration of the operating system and applications. For example, when interacting with a service in PowerShell, the user is really manipulating an object that represents the service. Service information is represented in the form of object properties. To start or stop a service, the developer invokes one of the object's methods.

The user can also continue to use traditional tools, such as the Service Control Manager, ipconfig.exe, net.exe, reg.exe, and shutdown.exe; and can take advantage of cmdlets like Select-String to manipulate the text that those Windows programs return. The user can also start Windows programs that have a graphical user interface at the Powershell prompt.

The PowerShell runtime can also be embedded in other applications. Microsoft Exchange Server 2007 and SQL Server 2008, for example, expose management functionality by means of PowerShell cmdlets and providers. All future Microsoft applications are to be PowerShell-aware.


Windows Powershell (Microsoft TechNet)

Windows PowerShell (Wikipedia)

Windows PowerShell Cmdlets (Microsoft TechNet)

A New Scripting Language (Microsoft TechNet)

Processing Objects (Microsoft TechNet)

Object Pipelines (Microsoft TechNet)