TFS Powershell PSSnapin

The October Team Foundation Power Tools drop includes three new features:

  • TFS Power Shell Extensions
  • TFS Windows Shell Extensions
  • Team Members Tool

The only one I care about is the Powershell extensions. Keith Hill has a great post with some examples.  I already had a script that made some .NET assembly calls to get me the latest good build off of TFS.  I converted that script to use the new snapin, and posted it below.  I’m sure some of this is not best practices, feel free to let me know if you have a cleaner implementation.

(Get-TfsServer -Name myTfsServer).GetService(Microsoft.TeamFoundation.Build.Client
.IBuildServer]).QueryBuilds("myProjectName", "myBuildName") | 
where { $_.BuildDefinition.LastGoodBuildUri -eq $_.Uri } | select DropLocation
Two lines in my profile.ps1: