How to get a complete list of workspaces in the server hosting TFS 2012

user2786451 picture user2786451 · Sep 17, 2013 · Viewed 10.8k times · Source

I am working on a server of which TFS 2012 was installed. Other than TFS 2012, there is also Visual studio 2010 and Visual Studio 2012 in the server. I would like to know if there is any way I can get a list of the work space in the local directory on that server?

What I want to do is, I want to run batch job which uses TF.exe to retrieve the latest sources code from TFS and put them into a directory. However, when I run the TF.exe command, I always got an error message "Unable to determine the source control server".

I research on the internet and I saw that I need to create workspace and mapped the workspace into a local directory, and then I can run TF.exe on that mapped directory.

Actually, I can create a new workspace and do a new mapping on my own. But I am afraid doing so may affect some existing setting (for I am completely new to TFS, I don't know what will be the impact be for adding new workspace and new mapping). So it would be much better if I can see if there are any existing workspace/mapping in that server.

Could anyone please help, or give me your advice under my scenario?

Answer

James Reed picture James Reed · Sep 17, 2013

To do this from the command line then you can use

tf workspaces /owner:* /computer:COMPUTERNAME /collection:http://TFSSERVER:8080/tfs/COLLECTIONNAME

This will list all of the workspaces on the machine.

You can then use the workfold command to understand the mappings.

tf workfold /workspace:WORKSPACENAME /collection:http://TFSSERVER:8080/tfs/COLLECTIONNAME

Alternatively download TFS sidekicks and use the workspace sidekick to query the server