PowerShell for TFS Query: 查看Bugs

2014-11-06  籽藤 

之前介绍过TFS Power Tools的安装,下面贴出PowerShell脚本,用于查看分配给自己的Bugs.

我把这个脚本设置为每天定时运行,在发报告的时候,就可以直接Copy网页上的结果;而不用等着VS打开那么麻烦了..

$SERVER = "http://vstfcsd:8080/tfs/windows%20azure%20commerce%20platform" #Full URL to the server $date = Get-Date #WIQL- Work Item Query Lanuage $QUERY = "SELECT [System.Id], [System.Title] FROM WorkItems WHERE [Work Item Type]='Bug' And [System.AssignedTo] = @Me AND [System.State] <> 'Closed' AND [System.State] <> 'Resolved' ORDER BY [System.Id]" #Execute the TFS Query via TFPT $TFSPTPATH = "D:\Program Files (x86)\Microsoft Team Foundation Server 2013 Power Tools" Set-Location $TFSPTPATH $idlist = .\TFPT.exe query /collection:$SERVER /wiql:$QUERY /include:data $table = "" #Write-Host $idlist if( $idlist -eq $null ) { $table = "<tr><td>0 items found</td></tr>" }else{ foreach($myBug in $idlist){ $td = "<tr><td>" + $myBug + "</td></tr>" $table += $td } } #Write-Host $table #Print the value on the powershell window $params = @{'Head'="<title>Daily Report for TFSQuery</title>"; 'PreContent'="<h3>Report for $QUERY - $date</h3>"; 'PostContent'= "<table>$table</table>" } ConvertTo-Html @params Out-File "D:\Team\dailywork\test.html" Invoke-Expression "D:\Team\dailywork\test.html" #Pop-up IE windows to show the result
441°/4415 人阅读/0 条评论 发表评论

登录 后发表评论