Formatting results of Get-ASAppServiceInstance command in AppFabric

by Matt Milner 23. February 2011 07:40

I’ve been working with AppFabric lately and one of the things I like to do is use PowerShell to get a sense of the current state of my workflows. Unfortunately, I don’t like the format of the output as I find it hard to read.  You can see an example of the default output here.

What I want is a nice succinct table.  So, I fiddled around a bit with PowerShell’s format-table command and was able to get my data looking like this:

The command is pretty simple. I use the Property parameter to the format-table command to identify three properties that I want, using expressions to go after the specific values in which I’m interested.

get-asappserviceinstance -groupby status | format-table -property @{n='Count';e={$_.Count}}, @{n='Status';e={$_.Groups[0].GroupValue}}, @{n='Status';e={$_.Groups[1].GroupValue}}

The expressions go into the objects returned by AppFabrics get-asappserviceinstance command when grouping by status.

Hopefully this will prove useful to those of you working with Windows Server AppFabric and PowerShell.