TFS & Visual Studio ALM – by Neno Loje

(formerly Team System, VSTS)

Clean old and unused workspaces and shelves from your TFS

March 3rd, 2011 · 6 Comments · Team Foundation Version Control, TFS Administration, Tools and Utilities

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]

Required parameters:  
/collection:<URI> URI of Team Project Collection (e.g. http://servername:8080/collection)
Optional parameters:  
/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.

tfsclean cleans up old workspaces and shelvesets

(Note: The user needs to have the ‘Administer workspaces‘ and ‘Administer shelved changes‘ permission on TFS)

Download the tool from here:

Prerequisite: This tool requires Team Explorer to be installed.



6 Comments so far ↓

  • Fred Nicoletti

    Hallo Neno,

    Danke für den bunten Frühlingsstrauss an Tools, den Du uns da in den letzten Tagen präsentiert hast!


  • neno

    @Fred: Es kommt noch mehr dort, wo diese kleinen Dinger herkommen, die bisher nur ein Schattendasein auf meiner Festplatte leben durften…

  • Buck Hodges

    Do keep in mind that there’s no way to recover a shelveset once it is deleted (other than from a database backup restored to a server, etc.).


  • neno

    Thanks, Buck. I updated the post to make that very clear.

  • Jean-Rene Roy

    Hi Neno,
    At my work place we add external Contractor directly in the group but no one what to do the cleanup. I need to clean the permission in the contributor group. Have you done something like that before?

    Jean-Rene Roy
    SQl Server MVP

  • neno

    Jean-Rene: What exactly do you want to “clean”? Members of the contributors group? Do you have so many that you don’t want to use the dialog to achieve this? On what criteria would you want to remove them?


Leave a Comment