I will be Judging the PowerShell 2011 Scripting Games

February 26th, 2011 / Development in a Blink

I’ve been invited to be a judge at the games again.

The 2010 Scripting Games produced terrific scripts from the community. Should be a lot of fun and great learning.

2011 Scripting Games


How PowerShell can Automate Deployment to Multiple Windows Azure Environments

February 25th, 2011 / Development in a Blink

The two blog posts below are providing insight into how to create an automated delivery pipeline to the Cloud, Microsoft Azure. I believe the same fundamentals can and ought be applied to the software development life cycle whether you have a hybrid or Enterprise model.

The first post is the updated SDK and PowerShell cmdlets for MSBuild and Azure.

The second is a walk through showing how to automatically build and deploy your Windows Azure applications to multiple accounts and use configuration transforms to modify your Service Definition and Service Configuration files.

Microsoft might even announce some of its new HTML5/JavaScript tooling plans at Mix ‘11

February 22nd, 2011 / Development in a Blink

Potentially on deck are new standalone tools and libraries for creating HTML5 client applications.

HTML5 and JavaScript tools: What could (and should) Microsoft do?

Related Posts


NYC Code Camp PowerShell Talk

February 21st, 2011 / Development in a Blink

I presented at the NYC Code Camp 2011 along with my Lab49 colleagues David Padbury, Jimmy Schementi and Scott Weinstein.

My talk was on PowerShell for .NET Developers. Here is a recording I did on that topic for Microsoft Channel 9 geekSpeak.

The attendees were great. Of the 50+, all heard about PowerShell and a few were using it in Production.

The questions went deep too:

Use PowerShell to Simplify Working with XML Data

February 17th, 2011 / Development in a Blink

Is an article I wrote and is posted HERE on Microsoft’s Hey Scripting Guy site. It compares XML to a PowerShell “DSL” (domain specific language) by using functions and script blocks (closures). Doing this, you create an internal DSL that provides even more capabilities.

I’d like to thank Ed Wilson for his comments, tweaks and publishing the post.


How to send PowerShell output to a JQuery interactive DataTable in a Web Browser

February 15th, 2011 / Development in a Blink

This post shows PowerShell code sending output to an interactive table in a Web Browser. The interactive table is achieved using JQuery and JQuery Datatables.


The first example pipes the Get-Process command output to Out-DataTableView (aliased to odv) and the properties Name, Company and Handles are selected.

If you don’t specify any properties, Out-DataTableView will inspect and display all the properties of the piped output.

Get-Process | odv Name, Company, Handles

Below is the result. Using JavaScript, JQuery, JQuery DataTables and Style Sheets (all out out of the box) you get a sortable (click on the column headings), serachable and pageable view of the data. Ready to slice and dice.

Need to get this tee shirt

February 7th, 2011 / Development in a Blink

I’ll be speaking at NYC CodeCamp February 2011

February 6th, 2011 / Development in a Blink

I am presenting PowerShell for .NET Developers.

It’s Saturday, February 19th. They will be several tracks and many speakers. Add yourself to the wish list here. It’s already sold out.

I will demo techniques for integrating/debugging PowerShell from and to C# code as well as using PowerShell with a  Windows Presentation Foundation (WPF) application. I’ll show reflection at the command line, object pipelining, working with XML, PowerShell’s Integrated Scripting Environment (ISE) and PowerShell’s REPL

Time permitting, I’ll demo some NuGet, a free, open source developer focused package management system for the .NET platform.


How to display a Windows Form using PowerShell

January 28th, 2011 / Development in a Blink

I came across a Microsoft IronPython post showing code displaying a Windows form. I copied and pasted the IronPython code into the PowerShell ISE (Integrated Scripting Environment) then:

  • Did an Add-Type on Systems.Windows.Forms
  • Added some dollar signs ‘$’
  • Changed ‘new’ to New-Object

The form is up and running. Clicking on the button adds one to a counter and displays it in the title bar.

A Non-Binary Deployment

Cool thing, if you have Windows 7 installed, you have PowerShell installed. You can copy and paste this code straight away into the PowerShell console and it will work.

Make Your PowerShell For Loops 4x Faster

January 16th, 2011 / Development in a Blink

Looping through information is a fundamental task. It is done many times a day by many people in many ways on computers. In PowerShell, one way to loop is using a For loop (see Slow Loop).

Hidden in this simple example is a performance hit where looping over 100,000 items has a 2 second response time rather than subsecond. That’s the difference of hitting enter and getting a prompt compared to counting 1 one-thousand, 2 one-thousand.

How To Practice PowerShell

January 10th, 2011 / Development in a Blink

Peek at PowerShell

Take a peek at some PowerShell code:

PS C:\> $properties = 'object oriented', 'duck typed', 'productive', 'fun'
PS C:\> foreach($property in $properties) { "PowerShell is $property" }
PowerShell is object oriented
PowerShell is duck typed
PowerShell is productive
PowerShell is fun

I am reading

Seven Languages in Seven Weeks” by Bruce Tate and it is a great book. Looking through the Ruby chapter, I was struck by how well Mr. Tate communicates key concepts of the language and saw how the examples could be demonstrated in PowerShell.

Go to specific parent directory with PowerShell

January 1st, 2011

After typing commands similar to  ’cd ..\..\..\’ a few too many times, I needed a better solution.

My first idea was to have something like cd… and depending on the number of dots go up to the nth parent. Still, I’d have to count how many directories up my target is.

A colleague of mine had a better idea:

Lets say you are in
and you would like to go to
Ideally you just type something like ‘cdto users‘ or even ‘cdto u

Find the implementation of that function here.

PowerShell Value Proposition

January 1st, 2011 / Development in a Blink

Three words describing my New Year’s resolution.

PowerShell Version 2.0 was released with Windows 7 in 2009. Jeffrey Snover, creator of PowerShell, is now lead architect of Windows Server. He believes it’s because Microsoft sees and believes in what PowerShell brings to the table. A Windows 8 beta may surface later this year.

The PowerShell community is thriving. Projects on CodePlex, tweets on Twitter and posts on blogs are up.

NuGet, a free, Microsoft backed, open source package management system for the .NET platform popped on to the scene sporting a PowerShell console inside Visual Studio. Already over 300 packages are in the repository and the version 2 roadmap is underway.

How to use PowerShell to Get NuGet Download Stats

December 26th, 2010 / Development in a Blink


David Fowler tweeted the link for viewing NuGet download stats. You can use the URL in the browser and you’ll see the XML. This PowerShell code demonstrates a few cool reusable ideas. Working with XML downloaded from a URL OData feed all in PowerShell.

Leveraging PowerShell’s .NET Framework integration (Net.WebClient) you download the XML string from the OData endpoint, convert it an XML Document using the [xml] accelerator and iterate the collection extracting the Id, converting the download count to an int and finally selecting the top 15 ( pipes to PowerShell’s Select cmdlet using the –First parameter).

I Presented at the NYC meet up on NuGet and PowerShell

December 22nd, 2010 / Development in a Blink


A co-worker David Padbury asked if I could do a session on NuGet, a free, open source developer focused package management system for the .NET platform intent on simplifying the process of incorporating libraries into a .NET application during development.

The demo covered:

  • The Package Manager Console, PowerShell inside Visual Studio
  • Get-Package, Install-Package, Uninstall-Package and Update-Package
  • Setting up a local NuGet Repository simply on the file system
  • Authoring NuGet packages with Nuget.exe and the XML spec
  • Using init.ps1, install.ps1 and uninstall.ps1 to add/remove/Import-Module my custom PowerShell module during a NuGet Install-Package

NimbleSet–Using PowerShell and WPK (WPF PowerShell Toolkit)

December 20th, 2010 / Development in a Blink

secretGeek posted his web version of NimbleSet (helps you compare two lists). Try it HERE.

I created his version in PowerShell using the WPK module from the PowerShell Pack. You’ll need to download and install the PowerShell Pack if you want to run the script.

Check out the source below, download it and give it a try.

If we want to see what items they have in common, click the ‘intersection’ button.

result (1 row)


To see which items are in the list on the left but not in the list on the right? Click ‘left only.’

result (3 rows)


Does PowerShell support High-order Functions?

December 11th, 2010 / Development in a Blink


In mathematics and computer science, higher-order functions, functional forms, or functionals are functions which do at least one of the following:

  • take one or more functions as an input
  • output a function.

Wikipedia – High-order Function

Generating Random Dates using PowerShell

December 8th, 2010 / Development in a Blink

Inspired by the post of I.M. TESTY

Get-RandomDate 1/1 10/1
Function Get-RandomDate {
    param (

    1..$howMany | % {
        $days = ($endDate-$startDate).days
        $startDate.AddDays( (Get-Random $days) )

Get-RandomDate 1/1 10/1            

# Result
Thursday, September 02, 2010 12:00:00 AM
Saturday, January 09, 2010 12:00:00 AM
Thursday, February 18, 2010 12:00:00 AM
Wednesday, April 07, 2010 12:00:00 AM
Thursday, July 29, 2010 12:00:00 AM

Note to self: How to programmatically get the MSBuild path in PowerShell

December 1st, 2010 / Development in a Blink

Other ways I’ve seen have been to get the directory from the registry. I prefer this approach.

Function Get-MSBuild {
    $lib = [System.Runtime.InteropServices.RuntimeEnvironment]
    $rtd = $lib::GetRuntimeDirectory()
    Join-Path $rtd msbuild.exe

This gets the directory for the latest installed .NET runtime and joins it with msbuild.exe.


& (Get-MSBuild)            

Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

MSBUILD : error MSB1003: Specify a project or solution file.
The current working directory does not contain a project or solution file.

I’ll Be Presenting On NuGet and PowerShell

November 24th, 2010 / Development in a Blink

At the New York .NET Meetup. You’ll need to RSVP.

Follow me on Twitter, I’ll be giving details on how to win a Microsoft Visual Studio 2010 Ultimate MSDN subscription.