Monday, February 19, 2024

// // Leave a Comment

How unlock TFS/DevOps files and delete Workspace without TFS sidekick?

 Team Foundation Sidekicks is a very good toll for Microsoft Team Foundation Server administrators which providing Graphic User Interface for administrative and advanced version control tasks in multi-user TFS environments. But Team Foundation Sidekicks is no more offering updated version the last release was for Team Foundation Server 2015.  TFS sidekick was really good tool which helps Administrator to delete workspace and to remove file locks remotely. 

Below commands are very helpful for Administrator to delete workspace and unlock check out Dev Ops files remotely.

 1. Go to the Visual Studio directory which is in Program files folder and the below to see the use Workspace on. In this example you can see this user has two workspace.


 C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer>tf workspaces /owner:jason.roy /collection:https://devops.azurehowtos.com/MyCollection/

Workspace      Owner               Computer     Comment
-------------- ------------------- ------------ -----------------------------------------------------------------------
MyWork     Roy,Jason         RedBull-2023

MyWork-1  Roy,Jason        RedBull-2023

Once you run the above command you will Workspace name, Owner of the workspace and computer name.

 

2. If you want to delete workspace you simple run the below command.

 

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer>tf workspace /delete /collection:https://devops.azurehowtos.com/MyCollection/Redbull-2023;jason.roy
A deleted workspace cannot be recovered.
Workspace 'MyWork;Jason.Roy' on server 'https://devops.azurehowtos.com/MyCollection/' has 49 pending change(s).
Are you sure you want to delete the workspace? (Yes/No) Yes

Type yes and press Enter, then it will delete the workspace. This option is really good if you want to delete the workspace of the employees who left the company and no more working on the projects. 

 

3. Instead of deleting workspace if you want to unlock specific file then you can run the below command.

 

tf undo $/MyCollection/Santy/Files/rptMem.rpt /workspace:"Redbull-2023";azurehowtos\jason.roy /s:https://devops.azurehowtos.com/MyCollection/

 

 OR

 

tf lock lock:none $/MyCollection/Santy/Files/rptMem.rpt /workspace:"Redbull-2023";azurehowtos\jason.roy /s:https://devops.azurehowtos.com/MyCollection/

 

the difference between tf lock and tf undo in below case.

  • To delete pending changes in another user's workspace, use the tf undo command.
  • To remove an exclusive lock on a file but not the pending changes, use the tf lock command.
Read More