Created
March 4, 2014 14:10
-
-
Save v2keener/9347116 to your computer and use it in GitHub Desktop.
Retrieve Work Hours from TFS with PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Taken from Julian Kay's Blog | |
http://juliankay.com/development/querying-tfs-with-tfpt-exe-and-powershell/ | |
#> | |
Function Get-WorkItemHours | |
{ | |
$month = (Get-Date).ToString("MMMM") | |
$year = (Get-Date).Year | |
$query = "SELECT [Completed Work] FROM WorkItems " + | |
"WHERE [System.AssignedTo] = 'Julian Kay' " + | |
"AND [Assigned Month] = '$month' " + | |
"AND [Assigned Year] = '$year'" | |
$hours = tfpt query /collection:$TFSSERVER /wiql:$query /include:data | |
$total = 0.0 | |
foreach ($hour in $hours) | |
{ | |
$total += $hour | |
} | |
$total | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment