TFS Power Tools Issues

During a forward integration, it is helpful to get a report of what changes occurred during that time period. This started out being done by hand but programmers hate doing by hand what should be easy to automate. There were many ways to produce the report but the easiest approach I found was to use the TFS PowerShell cmdlets in the TFS Power Tools. This allowed me to create a script that shows each change formatted the way I wanted it including a list of work items for each change. Here is the script:

 $changesets = get-tfsitemhistory . -recurse -Version "D09/01/2012~D12/31/2099"
foreach ($changeset in $changesets)
{
  "------------------------------------------------------------------------------------------------------"
  "Changeset: {0} " -f $changeset.ChangeSetId
  "Owner: {0}" -f $changeset.Owner
  "Date: {0}" -f $changeset.CreationDate
  ""
  "Comments: {0}" -f $changeset.Comment
  ""
  Get-TfsChangeset $changeset.changesetid | select changesetid -exp changes | format-table -auto
  "Work Items:"
  Get-TfsChangeset $changeset.changesetid | select changesetid -exp workitems | format-table id,title 
  ""
}
 

After upgrading to VS2012, the script stopped working and would only report the following errors:

 Unable to determine the source control server.
Unable to determine the workspace.

The first error message was coming from the get-tfsitemhistory command. I have more than one TFS enlistment on my machine so I figured it could be that. The command has a -server parameter so I attempted to use that by calling get-tfsserver. Get-tfsserver works just fine and is able to find the server. But get-tfsitemhistory fails with the "unable to determine the workspace" error. I've seen many possible solutions online about re-creating the workspace and connecting visual studio to the workspace but none of those worked.

My problem turned out to be VS2012. When you install VS2012, you need to update your TFS Power Tools. Here are the steps I followed:

  1. Open Add/Remove programs and uninstall Microsoft Team Foundation Server 2010 Power Tools
  2. Go to: https://visualstudiogallery.msdn.microsoft.com/b1ef7eb2-e084-4cb8-9bc7-06c3bad9148f
  3. Click on download and open the msi
  4. Choose custom installation and make sure that powershell cmdlets are installed