Saturday 30 December 2017

Script to Delete All Workspaces of a Computer from TFS

Sometime you need to clean up machines, especially build servers after a TFS upgrade to get the agents working as intended. If you ever come across a situation where you want to remove all Team Foundation Version Control (TFVC) workspaces from TFS for a given machine, considering all collections and all users, the script available here will help you to do that.

You can pass three parameters to this script.

  • tfExePath: Path of the tf.exe, typically for VS 2017 this will be “C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer”
  • tfsUri: Team Foundation Server Url
  • computerName: Name of the computer to remove workspaces

The script will iterate through each of the project collections and find all the workspaces for a given computer in TFS and remove them. You should be running this script from a machine where you have Visual Studio Team Explorer installed to get the tf.exe, and you should be logged in as an administrative user of TFS instance you are accessing. The accessibility to TFS from the machine you are running script should be available. You do not have to run this in TFS AT.image

No comments:

Popular Posts