Today I got a request to print the list of active TFS users. I first tried to get this information through the Team Foundation Sidekicks, but unfortunately I didn’t found an easy way to extract the list of users from this otherwise great tool.
In the end I used a different approach:
- Open SQL Server Management Studio
- Connect to your TFS Database instance
- Execute the following query for every collection database:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT IdentityName, | |
StartTime, | |
Command, | |
IPAddress, | |
ExecutionTime | |
FROM tbl_Command WHERE CommandId IN | |
(SELECT Max(CommandId) FROM tbl_Command WHERE Application NOT LIKE 'Team Foundation JobAgent' Group By IdentityName ) ORDER BY Last_Access_Time DESC |