New-Workflow –MakeItEasy: Authoring Workflows using PowerShell Extended Syntax

Some time back, in his blog post, Jeffrey Snover introduced one of the new Windows PowerShell 3.0 feature – Windows PowerShell Workflow. In that post, you saw a glimpse of how to author workflows using PowerShell syntax. This post dives into more details of authoring workflows using PowerShell syntax and various extensions to it. Why… Read more

New V3 Language Features

We’ve already discussed the biggest new PowerShell language feature – workflows – in a previous post.  In this post, I’m going to describe a number of small changes we’ve made to the language.  Most of the changes described here don’t introduce any new syntax, but I think you’ll agree that most of these changes make… Read more

Many² ways you can set a variable value

There are many ways to set a variable’s value. I just learnt one more yesterday. If you have others, please add comments # Simple# $ gets the variable, and = will assign it$a = 1 # With Variable Scope# The prepend is the scope, and could be global, script, and others# Useful when you want… Read more

Using a DSL to generate XML in PowerShell

A while back, Jeffrey posted an article on how to use string expansion and XML casts to build XML documents in-line in a PowerShell script: http://blogs.msdn.com/powershell/archive/2007/05/29/using-powershell-to-generate-xml-documents.aspx The overall feel of the approach that Jeffrey described is very much like that of ASP, JSP, PHP on any of the other systems that use “holes” to embed… Read more

Windows PowerShell in Action

Well folks, at long last, my book is almost done 🙂 Before it goes out for print, you can get electronic copies through Manning’s early access program: http://www.manning.com/payette/  The early access program is a chance for readers to provide feedback on a book so the author can fix things.  As Jeffrey says – enjoy! -bruce =========================================================… Read more

Joel-On-Software on the power of a good language

Joel Spolsky of Joel-On-Software fame, just posted a blog, “Can Your Programming Language Do This?” http://www.joelonsoftware.com/items/2006/08/01.html In this article, he drives home the point that when it comes to code: Maintainability, Readability, Abstraction == Good!  He then points out how languages can help or hinder this and goes on to articulate the things a language… Read more

Issues with Windows PowerShell syntax

REI recently posted some comments/requests about Windows PowerShell syntax at: http://blogs.msdn.com/powershell/archive/2006/04/25/583273.aspx#675133 Let’s go through a few of the points. …the syntax was just way too cryptic and unintuitive. Often it’s even dangerous. Like this: #PowerShell’s syntax causes dangerous problems generating incorrect results and no error for seemingly innocent expressions: function Pow($var, $exp) { [Math]::Pow($var, $exp)… Read more

Indirectly Invoking Methods Via Variablenames

PSMDTAG:FAQ: Can I specify a methodname using a variable? e.g. $x.$y() PSMDTAG:FAQ: Why do I get METHOD metadata when I specify a method without providing parentheses? One of the great things about Windows PowerShell is that it is a latebound language which allows you to do all sorts of incredibly powerful operations.  Consider the following… Read more

Type Shortcuts

PSMDTAG:FAQ: What is a TYPE SHORTCUT?PSMDTAG:FAQ: What are the TYPE SHORTCUTS?   Type shortcuts are a Windows PowerShell feature that allows you to reduce the amount of typing you have to do when specifying a type.    For example, the following 2 statements produce the same result: [System.Text.RegularExpressions.Regex]”^c.*” [Regex]”^c.*”   Jim Truher produced the following… Read more