Friday, January 11, 2013

The power behind PowerShell, "Windows PowerShell Language Specification Version 3.0"

Microsoft Downloads - Windows PowerShell Language Specification Version 3.0

Version: December 2012
Date published: 1/10/2013

Language: English

Windows PowerShell Language Specification Version 3.0.docx, 539 KB

Windows PowerShell is a command-line shell and scripting language that brings the power of the .NET Framework to command-line users and script writers. The specification in this download documents the Windows PowerShell language for Windows PowerShell 3.0. This specification is made available as part of the Microsoft Open Specifications program. For more information, see http://www.microsoft.com/openspecifications/en/us/programs/community-promise/covered-specifications/default.aspx.

Here's a snap of the 334 page DocX

image

And a snip of the Introduction.

1. Introduction

PowerShell is a command-line shell and scripting language, designed especially for system administrators.

Most shells operate by executing a command or utility in a new process, and presenting the results to the user as text. These shells also have commands that are built into the shell and run in the shell process. Because there are few built-in commands, many utilities have been created to supplement them. PowerShell is very different. Instead of processing text, the shell processes objects. PowerShell also includes a large set of built-in commands with each having a consistent interface and these can work with user-written commands.

An object is a data entity that has properties (i.e., characteristics) and methods (i.e., actions that can be performed on the object). All objects of the same type have the same base set of properties and methods, but each instance of an object can have different property values.

A major advantage of using objects is that it is much easier to pipeline commands; that is, to write the output of one command to another command as input. (In a traditional command-line environment, the text output from one command needs to be manipulated to meet the input format of another.)

PowerShell includes a very rich scripting language that supports constructs for looping, conditions, flow-control, and variable assignment. This language has syntax features and keywords similar to those used in the C# programming language (§C).

There are four kinds of commands in PowerShell: scripts, functions and methods, cmdlets, and native commands.

  • A file of commands is called a script. [Note: By convention, a script has a filename extension of .ps1. end note] The top-most level of a PowerShell program is a script, which, in turn, can invoke other commands.
  • PowerShell supports modular programming via named procedures. A procedure written in PowerShell is called a function, while an external procedure made available by the execution environment (and typically written in some other language) is called a method.
  • A cmdlet—pronounced "command-let"—is a simple, single-task command-line tool. Although a cmdlet can be used on its own, the full power of cmdlets is realized when they are used in combination to perform complex tasks.
  • A native command is a command that is built in to the host environment.

Each time the PowerShell runtime environment begins execution, it begins what is called a session. Commands then execute within the context of that session.

This specification defines the PowerShell language, the built-in cmdlets, and the use of objects via the pipeline.

Windows PowerShell: Unlike most shells, which accept and return text, Windows PowerShell is built on top of the .NET Framework common language runtime

Not a doc I think I'll be reading in too much detail, but still something I think great to have (you know, just incase...). Plus I like that this is just available...

No comments: