Tuesday 15 August 2017

TFVC History Report with PowerShell

Team Foundation Version Control (TFVC) is widely used with Team Foundation Server and in Team Services, as a source control system to manage source code repositories.Usage of TFVC can be found here. If you want to generate history report for TFVC including details of files changed and any work items associated with the changesets, you can use the script available at TechNet Gallery.

This script works with Team Foundation Server 2017 or later and with Team Services. In order to use the script you need to create Personal Access Token (PAT) for your profile. Instructions to create a PAT can be found here. This PAT should be scoped to as shown in below figure with Code(read), Work items (read) and Work items search (read) permissions.image

You can execute script with the parameters specified below.

  • token – generated PAT.
  • fromDate – the date the change history report should be generated from.
  • toDate – the date the change history report should be generated to.
  • sourceControlPath  - Path of the source control to consider
  • collectionUri – the URL of the collection

.\GetChangeHistory.ps1 -token "pat value" -fromDate "01-01-2017" -toDate "08-31-2017" -sourceControlPath "$/Project X" -collectionUri "https://yourteamservice account.visualstudio.com/defaultcollection"

When the script executed it will output a log showing each change history item being processed. An html report will be generated in the same location where the script is located.


Html report will have a link to the changeset and any work items associated to it, while listing all changed files. Changeset will include the changed person and the comments and date time information.



Await for similar script for Git version control in TFS and Team Services.

No comments:

Popular Posts