Technical Articles
F5 SMEs share good practice.
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

0151T000003d4bcQAA.jpg With yesterday's post, another 26 blog posts are in the can.  For those who missed the first, here's the complete list.


0151T000003d4bdQAA.jpg 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.
0151T000003d4beQAA.jpg 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!
0151T000003d4bfQAA.jpg 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.
0151T000003d4bgQAA.jpg 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.
0151T000003d4bhQAA.jpg 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.
0151T000003d4biQAA.jpg 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".
0151T000003d4bjQAA.jpg 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.
0151T000003d4bkQAA.jpg 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.
0151T000003d4blQAA.jpg 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.
0151T000003d4bmQAA.png 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.
0151T000003d4bnQAA.jpg 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.
0151T000003d4boQAA.jpg 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.
0151T000003d4bpQAA.jpg 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.
0151T000003d4bqQAA.jpg 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.
0151T000003d4brQAA.jpg 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.
0151T000003d4bsQAA.jpg 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.
0151T000003d4btQAA.jpg 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.
0151T000003d4buQAA.jpg 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.
0151T000003d4bvQAA.jpg 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.
0151T000003d4bwQAA.jpg 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.
0151T000003d4bxQAA.jpg 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.
0151T000003d4byQAA.jpg 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.
0151T000003d4bzQAA.jpg 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.
0151T000003d4c0QAA.png 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.
0151T000003d4c1QAA.jpg 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.
0151T000003d4c2QAA.jpg 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.
.content img { max-width: none; }
Version history
Last update:
‎10-Feb-2009 07:23
Updated by: