I need to create a scheduled task to remove a file lock or undo pending changes for a specific file (let's call this file $\MyProject\MyFile.cs).
I know I can do this via the TFS command line utility using tf undo, which requires you to specify the user and the workspace.
However in this case the scheduled task does not know which user or workspace is locking the file, so I can't specify this in the command.
Is there a way of removing a lock on a file for all users and workspaces?
I had the idea of using tf status command to retrieve the user and workspace the file is locked to, then passing this into my tf undo command, but tf status seems to only show me the user and not the workspace name.
Apolgies in advance if there is already an answer to this question. I've been looking for hours and couldn't find a solution.