In some enterprises and even inside of Microsoft we often partition our drives in two sections. The OS and often used applications (this is often our C: drive) and the data and enlistment section (this is often the D:/ drive)

Recently, I received a question about what happens to the tf workspace cache when I reimage my OS drive and how I can get it repopulated again. Before we answer the question I think there is one core set of steps and then three scenarios on top of that which result in different actions from the user at the end.

Scenario1

  • the user has a need to re-image or reinstall the Operating System on this box
  • the OS is reinstalled by the user, the machine name is kept
  • the user then install Visual Studio and TFS once again
  • the user connects to the server

In this case, there is nothing you have to do as a user. The workspace cache file will be regenerated automatically

Scenario 2

  • As part of the new OS install I actually changed my computer name. I reinstalled Visual Studio and the Team Explorer.

Well in this case you do have to tell TFS version control that the machine name for this workspace has been changed.  To do this you follow the documented syntax from msdn.

tf workspaces [/owner:ownername] [/computer:computername]  [/server:servername] [/format:(brief|detailed)]  [/updateUserName:oldUserName] [/updateComputerName:oldComputerName]

The command to execute is:

tf workspaces /server:servername /updateComputerName:oldcomputername

Scenario 3

  • I reinstalled the OS and only team explorer so Visual Studio is not installed and I use the command line so no UI please

This is different from the first scenario because there is no UI that is triggering an automatic regeneration of the client cache file.  In this case you need to force that to happen. For this will we again use the workspaces command. The syntax is:

tf workspaces /server:servername

 

There you have it ! How to reuse your workspace after a reinstalled.