Useful TFS Commands

There are a few commands you can use with TFS source control that come handy from time to time, specifically when you need to do something on behalf of another person.  They are

  • List workspaces for a user
  • Delete a workspace for a user
  • Undo checkout of a file for a user

These come in handy when someone leaves a team, but still has files checked out.  These commands all use tf.exe utility that comes with Visual Studio.  To run these commands you need to open Visual Studio Command Prompt.

To list workspace for a user, type the following.

tf workspaces /owner:DOMAINuserID

 

To delete a workspace for a person, type the following.

tf workspace /delete WorkspaceName;DOMAINuserID

 

To undo checkout for another person type the following.

tf undo /workspace:WorkspaceName;DOMAINuserID "$/FullPathToFileToUndo"

 

Enjoy.

One Comment

  1. Another one I’d add is deleting a work item. We frequently have requests from our QA team to delete some bugs in TFS 2010 that are duplicates or some other bugs…

    witadmin.exe destroywi /Collection:http:\[ServerName]:8080tfs[CollectionName] /id:[WI ID]

Leave a Reply

Your email address will not be published. Required fields are marked *