The Usual Tech Ramblings

TFS, workspaces, and past employees

After the last release, it was time to archive a few previous branches we had setup. This is usually a pretty simple operation, but becomes a lot more complicated when employees with active workspaces are no longer with the company…

Whilst trying to undo a handful of unimportant pending changes, I stumbled across a few accounts that had code checked out, but were no longer with us. Whilst trying to run the undo command, you get an interesting error:

> tf undo /workspace:theirmachine;theiruser $/Project/development/branch/id/
TF50605: There was an error looking up the SID for theiruser.

At first, I was a little baffled, then realized the SID is no longer valid because the user was purged from active directory after a certain period of time. This left a floating workspace, with no owner. As we know the workspace is no longer usable, and the person is no longer with the company, I figured we’d remove the workspace as well as undo their changes. Unfortunately, you get the same issue:

> tf workspace /delete theirmachine;theiruser
TF50605: There was an error looking up the SID for theiruser.

You should have seen that coming, TFS needed to look at the SID to remove the workspace. The fix for this is actually pretty simple, and you end up diving into some SQL, and the TFS database itself. Dave Hope has a great roundup of the steps required to fix the issue over here. Fairly simple, but you’d think Microsoft would tie some way into the tools to handle this without having to delve into the database.