Saturday, July 6, 2013

List all WorkSpaces in TFS, Removing TFS workspaces from old users or old computers

to list all the workspaces

c:\projects>tf workspaces /owner:* /computer:*


When working with Microsoft Team Foundation Server, sometimes it can be necessary to cleanup old workspaces.  For example, when a computername is re-used, and the same local directory is used by the new user to map a TFS folder.

You need the tool tfs.exe, which is installed togetcher with Visual Studio.  You can start a Visual Studio Command Prompt. I tested the procedure below on Visual Studio 2008 and Visual Studio 2010.

In the commands below, replace serveraddress with your TFS http or https address, e.g. https://tfs.mycompany.com:8443.  You can find it in Visual Studio: menu "Team", menu-item "Connect to Team Foundation Server...", button "Servers..."

The existing workspaces for some "computername" can be queried with this TFS command:
tf.exe workspaces /computer:computername /owner:* /format:detailed /server:serveraddress
You get a list of all workspaces, with the existing mappings. It is the workspace name (behind "Workspace:") and the owner that you need in order to delete the workspace.

Now run this TFS command to remove the workspace "workspacename" for owner "owner":
tf.exe workspace /delete workspacename;owner /server:
serveraddress

The following example displays a list of all workspaces for the current user on the current computer.
c:\projects>tf workspaces
c:\projects>tf workspaces /owner:* /computer:* /server:https://***.visualstudio.com/defaultcollection.


ref : http://msdn.microsoft.com/en-us/library/54dkh0y3(v=vs.80).aspx,
http://mycomputeradventures.blogspot.in/2012/01/removing-tfs-workspaces-from-old-users.html

No comments:

Post a Comment