Welcome to EMC Consulting Blogs Sign in | Join | Help

Stuart Preston's Blog

Stuart was CTO for Application Consulting EMEA at EMC Consulting until October 2009, now blogging at http://stuartpreston.net

Cleaning up multiple defunct Team Projects within Team Foundation Server

If, like us at Conchango you are developing Reports and Process Templates for Team Foundation Server, you will end up with a lot of defunct Team Projects that are taking up space for no reason on your development server (and also slowing down the Warehouse refresh cycle).

Looking for an easy way to clean up, I found the command-line tool TFSDeleteProject.exe (typically in %ProgramFiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies or Tools depending on whether you are on Beta 3 Refresh or a later build...) and cobbled together this batch file to call it.  I thought I'd share as people forget the power of "FOR /L" in a batch file and start using funkier things like Monad ;)

The following batch file will delete Projects test1 to test100 inclusive (and associated Build items, Work Items, Reports deployed to Reporting Services and the WSS site) when run on the application server:

@echo off
c:
cd\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies
set TEAMPROJECTPREFIX=test
FOR /L %%G IN (1,1,100) DO echo Deleting Project: %TEAMPROJECTPREFIX%%%G && tfsdeleteproject.exe /q /force /TeamFoundationServer:%COMPUTERNAME% %TEAMPROJECTPREFIX%%%G

If you are interested, this could also be achieved in one line of Monad (Beta 2) script as follows ;)

$prefix="test";cd "\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies";for($x=1;$x -le 100;$x++){echo "Deleting Project $prefix$x";.\TFSDeleteProject.exe /q /force /TeamFoundationServer:$env:COMPUTERNAME $prefix$x;}

 

Published 06 January 2006 14:00 by Stuart.Preston

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit

This Blog

Syndication

News

I have now left EMC Consulting and can be found at http://stuartpreston.net
Powered by Community Server (Personal Edition), by Telligent Systems