2012-11-02

Updating your Team Foundation Service Uri to the new tfs.visualstudio.com

Microsoft has decided that the Team Foundation Service (I'll start calling it TFSvc for short) has had enough testing and that it is now live and out of preview. They've also put it under a new domain name, tfs.visualstudio.com.



The old domain tfspreview.com will remain operational for a while, but in time it will be replaced. So there will come a time for you to update your Visual Studio TFS servers list with the new domain names.

If you have just one TFSvc project collection, that's easy. Just remove it from Visual Studio and add it again under the new name. But if you have a lot of Servers and ProjectCollections (like me) , then the following PowerShell script will make your life easier.

Warning Tinkering with the windows registry can seriously cripple your windows installation. I've tested the below script on my machine and there it works. Be sure to export your current settings with regedit to ensure you're not losing any important information.
Get-ItemProperty -Path HKCU:\Software\Microsoft\VisualStudio\*\TeamFoundation\Instances\*.tfspreview.com Uri | %{set-itemproperty -Path $_.PSPath Uri -Value ( $_.Uri -Replace ".tfspreview.com/", ".visualstudio.com/" )}

Get-ItemProperty -Path HKCU:\Software\Microsoft\VisualStudio\*\TeamFoundation\Instances\*.tfspreview.com\Collections\* Uri | %{set-itemproperty -Path $_.PSPath Uri -Value ( $_.Uri -Replace ".tfspreview.com/", ".visualstudio.com/" )}

Get-ChildItem -Path HKCU:\Software\Microsoft\VisualStudio\*\TeamFoundation\Instances\*.tfspreview.com | Rename-Item -NewName { $_.PSChildName -Replace ".tfspreview.com$", ".visualstudio.com" }

Watch the wrapping! This script should just consist of three lines. The first updates all Server Uris, the second all Project Collections and the third will rename the server in the server dropdown. Double clicking the powershell script will select all.

I tried finding a simpler solution (directly in Visual Studio, tf.exe or tfpt.exe) but there doesn't seem to be a way to update the servers list without first removing the old reference.

PS: Thank you Stackoverflow for your quick help with PowerShell. I've got a long way to go with that it seems :).

Download the script.