Cleaning Up Team Foundation when a Developer Leaves the Team

Occasionally someone leaves a development team. It could be a long time team member or a contract developer who has completed their project. Aside from all the physical office changes you have to make (cleaning the desk, reformatting a workstation) there is the virtual office housekeeping. We recently had an offsite developer finish a project we’d contracted them for and I was left with the task of cleaning them out of the branch we’d set up for them in Team Foundation. The only problem was, there were locks and pending changes… from a remote machine I can’t access.

Command Line Tools to the Rescue!

Luckily Team Foundation has a few command line tools to fix these problems. Here are the three steps needed to clean up after a departed dev.

For this example

  • The developer’s Active Directory Account is: OutsideDev1
  • The TFS server is
  • The workspaces are: MYHOMECOMP and WORKSTAT10
  • The branch they were working in is: $/Root/Project/ExternalDev

1. Find out what workspaces they’ve been working in.

These can be listed with the command:

tf workspaces /server:“” /owner: OutsideDev1


2. Undo any pending changes the user has left open (why would they do that?) and remove any outstanding locks.

This must be done for each workspace the user has changed.

tf undo /server:“” /workspace:MYHOMECOMP;OutsideDev1 $/Root/Project/ExternalDev /recursive
tf undo /server:“” /workspace: WORKSTAT10;OutsideDev1 $/Root/Project/ExternalDev /recursive


3. Remove the workspaces that the user created

Again, this must be done for each workspace the user has changed.

tf workspace /delete /server:“” MYHOMECOMP;OutsideDev1
tf workspace /delete /server:“” WORKSTAT10;OutsideDev1


And you’re finished. Now you can delete the user or the branch or whatever else you need to do.

Add comment

  Country flag

  • Comment
  • Preview

Month List

Page List