Monday, February 22, 2016

TFS PowerShell Query Blink(1) Integration

Because why not really. I wanted to query TFS with PowerShell anyway so I might as well integrate it with my Blink(1) USB LED.

Power Tools

First you need to download and install Team Foundation Server Power Tools. Here is the link for the 2015 version: https://visualstudiogallery.msdn.microsoft.com/898a828a-af00-42c6-bbb2-530dc7b8f2e1.

Make sure you do a custom install because for some reason the PowerShell cmdlets are not selected in the default install.

Script

I created this script to connect to our TFS server and connect to the project I wanted to monitor. I wanted to see all defects that were not closed, back log, or resolved state.


This will take the current count from TFS, and compare it with the previous count stored in a text file. I know this is low tech but I wanted a quick solution.

Blink(1) Integration

You can do whatever you want with the basic count code. If the current defect account is lower than the previous you can send an email, update a database, update a webpage, whatever. I enabled the API on the Blink(1) and decided that I would play a color pattern if the defect count was lower, and a different color pattern if the defect count was higher.

Final Script

So then I set the PowerShell Script to run every 5 minutes using task scheduler.

powershell -file "C:\scripts\CRM_DefectCount.ps1"

If the defect count goes up I display the Fire Engine Pattern, if the defect count goes down I display the dancefloor pattern. Below is a video showing how it works.


0 comments:

Post a Comment