The command line utility "tfsclean.exe" helps with two scenarios:
- You want to find and delete old worspaces and shelvesets (oder than XX days).
- You want to find and delete workspaces and shevlesets from a certain user
(e.g. when the user left the company)
Caution: There’s no way to recover a shelveset once it is deleted.
tfsclean.exe /collection<URI> [/delete] [/maxage:n] [/username:text] [/excludeworkspaces] [/excludeshelvesets]
|/collection:<URI>||URI of Team Project Collection (e.g. http://servername:8080/collection)|
|/delete||Required to actually delete items (otherwise it runs in readonly mode)|
|/maxage:<number>||Specified the maximum age in days (default is: 365)|
|/username:<name>||Only clean items from specified user (e.g. DOMAIN\username)|
|/excludeworkspaces||Do not clean workspaces.|
|/excludeshelvesets||Do not clean shelvesets.|
(Note: The user needs to have the ‘Administer workspaces‘ and ‘Administer shelved changes‘ permission on TFS)
Download the tool from here:
- For Team Explorer 2010: TfsClean.exe (.ZIP, 4,87 KB)
- For Team Explorer 2012: TfsClean.exe (.ZIP, 9,87 KB)
- For Team Explorer 2013: TfsClean.exe (.ZIP, 13,01 KB)
- For Visual Studio 2015: TfsToolsSuite.zip
Prerequisite: This tool requires VS or Team Explorer to be installed.