Skip to content

Instantly share code, notes, and snippets.

@leniency
Created June 9, 2014 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leniency/04cd6b2fd4c8cfd75438 to your computer and use it in GitHub Desktop.
Save leniency/04cd6b2fd4c8cfd75438 to your computer and use it in GitHub Desktop.
# Server and Project configs.
$CollectionUrl = "https://[TEAM FOUNDATION SERVER]/[PROJECT COLLECTION]"
$projects = ("[PROJECT 1]", "PROJECT 2")
# Work Item Locations
$baseLocation = Split-Path -parent $PSCommandPath
$witdLocation = $baseLocation + "\Core.Process\WorkItem Tracking\TypeDefinitions"
# Admin Import Command
$WitAdmin = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 12.0\Common7\IDE\witadmin.exe"
Write-Output "- Config ----------------------------------------"
Write-Output "Projects: $projects"
Write-Output "Base Location: $baseLocation"
Write-Output "WITD Location: $witdLocation"
Write-Output "CollectionUrl: $CollectionUrl"
Write-Output "WitAdmin: $WitAdmin"
Write-Output "- Start -----------------------------------------"
# Loop all projects.
foreach ($project in $projects)
{
Write-Output " - $project -----------------------"
# Select all Work Item Template xml files.
$items = Get-ChildItem *.xml -Path $witdLocation
$itemsFound = $items.Length
Write-Output "Importing Work Item Templates, found $itemsFound"
# Loop all Work Item Templates found and import them to the project.
foreach ($item in $items)
{
$witd = $item.FullName
Write-Output " Importing Work Item Type: $witd"
& $WitAdmin importwitd /collection:$CollectionUrl /p:$project /f:"$witd"
}
# Import Categories
Write-Output " Importing Categories..."
& $WitAdmin importcategories /collection:$CollectionUrl /p:$project /f:"$baseLocation\Core.Process\WorkItem Tracking\categories.xml"
# Import Categories
Write-Output " Importing Process Config..."
& $WitAdmin importprocessconfig /collection:$CollectionUrl /p:$project /f:"$baseLocation\Core.Process\WorkItem Tracking\Process\ProcessConfiguration.xml"
}
Write-Output "- End -------------------------------------------"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment