PowerShell's Cmdlet.WriteObject()

By Michael Flanakin @ 3:47 AM :: 3837 Views :: .NET, Research, Tools/Utilities :: Digg it!

Late last year, I saw a Channel9 Mobile-ready link Syndicated feed video on a tool being developed by Microsoft Research (MSR), FastDash Mobile-ready link, which is obviously an acronym for Fostering Awareness for Software Teams Dashboard. Actually, I'm not sure how much the acronym is still being used since the capitalization seems to have changed in recent usage, but whatever. The bottom line is, if you haven't seen the video, you should go check it out. There's another short spot with it and a tool called DynaVis Mobile-ready link, which is also in development by MSR, that you should check out as well. Heck, if you don't frequent Channel9 and you develop with Microsoft tools and technologies, you're missing out; but I digress... After seeing FastDash, I had to have it. Essentially, the tool gives you insight into what your dev team is doing. There's a huge potential for what this could be and I'd like to see it grow into something that's included in the Visual Studio tool set. I have no idea if/how that might happen, but, given my interest in research, I volunteered my time to the team. For the next release of FastDash, we're planning on changing how the tool functions a little. We'll be using another tool called PipeDream to create the UI. Now, this is something I'm still wrapping my head around, so forgive me if it sounds odd. PipeDream uses PowerShell cmdlets and what it calls vislets to generate output. An example of this might be to use a Get-CpuUsage cmdlet piped to a progress bar vislet to see how your CPU is being utilized.

So, I'm creating some PowerShell cmdlets to access TFS resources and something funky started to happen... When I call Get-TFWorkItemArea, I'm getting a list of the child areas for the first area. That's strange. After digging into it more, I realized it was actually giving all the child areas, but I only had children on one area node, so that's why I was just seeing the first one's children. Apparently -- and this still doesn't make complete sense to me -- the Cmdlet.WriteObject() method is displaying the object's child nodes when I tell it to enumerate a collection. Very strange. There are 2 ways to call the method, one is passing it an object and the other is passing it a collection and telling it to enumerate thru the collection. Being new, I assumed enumerating thru the collection was the best option, so that's what I went for. Of course, I was wrong. I still have no idea why this happened. I may dig into it one day, but for now, I'm just glad it's working again. I'd be curious to see how other people are using it.