Moving From One Computer To Another With Existing Checkouts In TFS (Team Foundation Server)

Posted by Paul Farrow - Under: Microsoft Windows, Software

My laptop was corrupted and decided to move to another laptop at work. I had existing checkouts so I copied all the code involved to the new laptop. Then I couldn’t add the workspace with the same name as it kept saying the workspace exists on my old machine.

I looked around at posts on the internet and they were suggesting to use the tfs commands

I tried to use

tf workspaces [/updateComputerName:oldComputerName][workspacename]

Now I don’t know what was wrong but it didn’t work at all. So I took the brute force approach and updated the TFS database itself using the SQL management studio.

I used

UPDATE [TFSDBName].[dbo].[tbl_Workspace]

SET Computer = ‘NewMachineName’ WHERE Computer = ‘OldMachineName’

and that worked a treat.   If your worried then do a select first and make sure you know how many it should be updating first and do a begin transaction before the statement – just to make sure your updating the right amount.  Or even do a select afterwards to see the data changed and then issue a commit command.