Additional Upgrade Script for Fixing Build Agent Registration

We have found that in some cases the registration of an upgraded build agents fails, with the following error:

Error occurred while configuring TFSBuildServiceHost with Lab configuration.
ExceptionType: MicrosoftTeamFoundation.Build.ClientBuildServiceHostAlreadyExistsException.
ExceptionMessage: A build service host already exists for computer VMNAME.CONTOSO.COM.
Specify a different computer name and try again.

This happens only for systems that were upgraded from Beta2 and not to fresh installations. To fix this issue, you should run the attached script which will fix the build agents registration for all project collections.

Run the script from either the TFS machine or any machine that has Visual Studio installed as a TFS Administrator.

Steps to run the script:

  1. Copy the script to local folder, say c:\temp
  2. Launch powershell.exe and navigate to the script folder
  3. Run the Set-ExecutionPolicy cmdlet appropriately to allow running scripts. Example: “Set-ExecutionPolicy Unrestricted”
  4. Run the script: .\RCUpgradePatch.ps1 -atUrl <ApplicationTierUrl>. Example: .\RCUpgradePatch.ps1 -atUrl "https://abc-tfs:8080/tfs"

The upgrade document is now updated, with a link to the attached script.

RCUpgradePatch.ps1