Tidying up TFS workspaces on the server.

Wow, TFS can be a pain at times.

View workspaces on server

To find all the workspaces that are currently on your TFS server you can fire up “Developer Command Prompt for VS2013″ Get to this by going Start –> Visual Studio 2013 –> Tools

Type in the following command:

tf workspaces /owner:\* /computer:\* /server:http://SERVER_NAME:8080/tfs

This lists all the workspaces that are on the server for all users and all computers. I could instantly see the names of people who had left the company and also many duplicates for developers that are still here.

Deleting workspaces

To Remove the workspaces issue the following:

tf workspace /delete /server:http://SERVER\_NAME:8080/tfs/ PC\_NAME;UserName

You can query for specific users or computers by changing the * in the first query, this is in case you have a lot of workspaces like I did. I simply changed the query to the username of the people who I know have left the company, and then used the output of this to build the delete query until all were removed.

We now have a nice tidy TFS server… or at least tidier