Arithmetic Operators: Unlike strongly typed languages like C/C++ and Java, PowerShell is a dynamically typed language meaning that it can "morph" data types depending on the context in which they are used. This comes in handy when you need to do string manipulations. PowerShell has the standard arithmetic operators you would expect from basic programming language.

begin: For all you Cmdlet writers out there, you may be wanting to be able to create a script level function that behaves like a Cmdlet in that it allows for initialization before the first pipeline object is available, an ability to process each object in the pipeline independently, and perform some finalization after all the pipeline objects have been processed. This can be achieved with the begin, process, and end keywords!

Cmdlet: CmdLets (pronounced "Command-let"), functions, scripts, and native Win32 executables are the four types of commands supported in PowerShell. A Cmdlet is implemented by a .NET class that derives from the Cmdlet base class in the PowerShell SDK. This class is compiled into a DLL and loaded into the PowerShell process. Since a Cmdlet is native code loaded in process, it's the most efficient of the four types of commands to execute.

Debugging: Debugging is a very large category so I'll scan over the various components and dig more into script level debugging since that is what most users will use most often.

ExecutionPolicy: One of the main features of PowerShell is the ability to execute scripts. But, scripts are not inherently "safe" and since PowerShell has no concept of sandboxing, the execution of scripts are disabled by default. The default way to execute scripts is via the console interpreter. But, since PowerShell's function is to execute scripts, there has to be a way to enable it in your environment. The way to configure this is with the PowerShell Execution Policy.

Format Operator: Most often, PowerShell's build in output formatting is good enough for your needs. But, there will always be those times when you want a more fine grained control over the formatting of your output. You may also want to format strings in a specific way. Enter the format operator "-f".

Generics: Generics allow you to create generic objects such as collections without being constrained to the specific type of object that it contains. Generics introduce the "type parameter" that you pass in to the creation of an object that determine the final types of some part of that said object.

Here-String: A here-string is used to embed large chunks of text inline in a script into a single string literal. This is very similar to a feature in C#, but the difference is that in PowerShell the here-string begins at the end of a line and the terminating sequence must be at the beginning of a line.

is: The type of an object is key to figuring out what operations can be performed on it. In PowerShell, variables are loosely typed and can be converted on-the-fly to accommodate certain operators (see my article on Arithmetic Operators for some examples). Sometimes implicit determination as to operations on a variable is not good enough and you would like to explicitly specify them.

JavaScript: PowerShell is a very extensive scripting language, but it is relatively new to the scene of windows systems management. Before PowerShell, network administrators used a combination of other scripting languages to manage their systems from simple batch files to more advanced VBScripts. The ability to integrate the older scripts into PowerShell can be very valuable during the transition process of moving from old processes to newer ones.

Keywords: A keyword, in a programming language such as PowerShell, is a word or identifier that has a particular meaning to that language. In most languages, keywords are reserved words - meaning that they cannot be redefined or aliased over. Keywords "if" and "else" may be familiar as they are common across many languages.

Location: The current working location is the default location to which commands point if you don't supply an explicit path to the item or location that is affected by the command.

Matching: Along with the basic comparison operators (-[ci]eq, -[ci]ne, -[ci]gt, -[ci]ge, -[ci]lt, -[ci]le, -[ci]contains, and -[ci]notcontains), PowerShell has a number of operators allowing one to perform pattern matching comparisons. These operators work on strings, matching and manipulating them using the wildcard and regular expression patterns.

Numbers: PowerShell supports all of the basic .NET numeric types and performs conversions to and from the different types as needed. In addition, PowerShell supports Default Type Determination, and Multiplier Suffixes.

Output: PowerShell, like most other scripting languages, wouldn't be much use without an input and output system for retrieving or sending data. PowerShell has various output systems.

Parameters: Parameters (or arguments) are how you customize the actions of a command. There are 4 types of commands in PowerShell, scripts, functions, Cmdlet's, and External Commands. Scripts and Functions are the areas I'm going to focus on here and I'll show you how parameters are defined in those two command types.

Queues: A queue is a particular kind of collection in which the entities in the collection are kept in order. Operation on a queue are to add items to the end position and remove them from the front position. As a First-In-First-Out (FIFO) data structure, the first element added to the queue will be the first one to be removed. There are many types of Queues that you can work with, including native .NET Queues, Windows Azure Queues, and IBM WebSphere MQs.

Runspace: A runspace provides a way for a hosting application to execute pipelines programmatically. Runspaces construct a logical model of execution using pipelines that contains Cmdlets, native commands, and language elements.

Synthetic Members: Objects that you can add to existing objects are referred to as Synthetic Members since they are not natively part of the existing object. PowerShell makes use of this ability to dynamically add members to objects for adaptation and extension. This allows you to work with two different objects much the same way.

Type Literals: If you've seen any example PowerShell scripts, you've likely seen some syntax that looks like [type]. This is referred to as a type literal. In PowerShell, you can use type literals to specify a particular type for your operation.

Unraveling: To unravel is to "separate or disentangle the threads" or "to free from complication or difficulty; make plain or clear". One problem that people run into with .NET methods that return enumerators is that PowerShell will unravel the enumerator by default. By this I mean that it will "take it apart" and put it in a format that is more understandable to the user.

Voidable Statements: The designers of PowerShell came up with the concept of voidable statements. This means that certain types of expressions, when used as statements, do not return values. Voidable statements include assignments and the increment and decrement operators. When they are used in an expression, they return a value, but when they are used as a standalone statement, they return no value.

Widening: Part of this dynamic type feature, is the concept of widening. Widening refers to the act of converting a value to a representation that can handle larger, or wider, numbers.

XML: XML (Extensible Markup Language) is being used more and more in today's computing environments. PowerShell is no exception in that it uses XML for its type and configuration files as well as for it's help system.

Yellow: PowerShell is really an engine that operates within a hosting application, the default being the PowerShell.exe command line application. The host serves to expose a command line and a host interface to communicate with the commands invoked by the command line. One of the features of the host interface is to assign colors to output.

zh-CHT: PowerShell 2.0 added features that make script internationalization relatively simple to implement. The script internationalization features query the user interface culture of the operating system during execution, import the associated translated text strings, and allows you to display them to the user. zh-CHT is just one of the many language cultures you can support with PowerShell.

last modified: January 10, 2013

0 Comment(s):

You must be logged in to post comments.

About the Author

Joe Pruitt

I'm a Principal Strategic Architect with the DevCentral team. I specialize in iControl and occasionally am asked to play code-monkey for our website.

I've been with F5 since 1998 when Product Development was less than 10 folks. As the original designer and inventor of iControl, I hope I'm help to folks on the iControl group. I've served as F5's technical representitive for WS-I and OASIS but am now primarily focused on Developer Community and building wicked cool stuff out of F5 products.

My favorite quote is: "Try not! Do, or do not. There is no try!" from the infamous Yoda.

When not working on DevCentral issues or building cool projects with F5 gear, I like to write code, play soccer, ski, strum the guitar, and coach sports teams for my kids.