Created
June 9, 2014 21:09
-
-
Save leniency/04cd6b2fd4c8cfd75438 to your computer and use it in GitHub Desktop.
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
# 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