Adding Issue WorkItems In VS2010 Using PowerShell

 
Adding workitems to Tfs is easy using the get-tfs.ps1 script included in the Tfs 2008 PowerTool.
 
Save the below Add-Issue.ps1 as New-Issue.ps1 and use it like this:
 
$tfs = .\get-tfs.ps1 http://tfs2010:8080/tfs # Change uri appropriately
$w = .\Add-Issue.ps1 "MyTitle" "MyDescription"
 
Add-Issue.ps1 script:
 
param(
    [string] $title = $(throw 'A Title is required'),
    [string] $description = $(throw 'A Description is required')
)
 
begin
{
}
 
process
{
    $w = new-object Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem($tfs.WIT.Projects[0].WorkItemTypes["Issue"])
    $w.Title = $title
    $w.Description = $description
    $w.Save()
    return [PSObject]$w
}
This entry was posted in VS2010. Bookmark the permalink.

Leave a comment