Skip to content

Instantly share code, notes, and snippets.

View adamskt's full-sized avatar
⌨️
Typing and sometimes moving the mouse.

Kelly Adams adamskt

⌨️
Typing and sometimes moving the mouse.
View GitHub Profile
@adamskt
adamskt / GetLatestTfsDropLocation.ps1
Last active October 5, 2015 22:58
A way to get the latest successful drop location from a TFS build.
Add-Type -AssemblyName "Microsoft.TeamFoundation.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
Add-Type -AssemblyName "Microsoft.TeamFoundation.Build.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
$tfsUri = New-object Uri("[[http://your.tfs.server:8080/defaultcollection]]")
$teamProjectCollection = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($tfsUri)
$service = $teamProjectCollection.GetService([Type]"Microsoft.TeamFoundation.Build.Client.IBuildServer")
$spec = $service.CreateBuildDetailSpec("[[Your Project Name]]", "[[ Your build definition name]]")
$spec.MaxBuildsPerDefinition = 1
$spec.QueryOrder = [Microsoft.TeamFoundation.Build.Client.BuildQueryOrder]::FinishTimeDescending
$spec.Status = [Microsoft.TeamFoundation.Build.Client.BuildStatus]::Succeeded
@adamskt
adamskt / GetLatestDropLocation.ps1
Created June 8, 2012 14:51
A function to get the latest TFS 2010 successful build drop location for a given project and definition.
function Get-LatestDropLocation {
param(
[Parameter(Position=0,Mandatory=$true)] [string]$tfsLocation,
[Parameter(Position=1,Mandatory=$true)] [string]$projectName,
[Parameter(Position=3,Mandatory=$true)] [string]$buildDefinitionName
)
Add-Type -AssemblyName "Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
Add-Type -AssemblyName "Microsoft.TeamFoundation.Build.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
$tfsUri = New-object Uri($tfsLocation)
@adamskt
adamskt / Exterminate.ps1
Created October 27, 2015 20:54
Clean up bin/obj files in a solution, now with WhatIf support
function Exterminate {
[CmdletBinding(SupportsShouldProcess = $True)]
Param($path = ".")
Get-ChildItem -Path $path -Include bin,obj -Recurse | Remove-Item -Recurse -Force
}
@adamskt
adamskt / DynamicParamsExample.ps1
Last active October 24, 2016 16:42
Moving Quickly Among Branches With PowerShell Dynamic Parameters
function Get-AllBuildFolders([string] $root) {
$search = [uri]::EscapeDataString("path:$($root) folder:Build child:Framework.ps1")
$uri = "http://localhost:8081/?s=$($search)&j=1&c=255&path_column=1" #Fix url to your Everything port
$result = Invoke-RestMethod -Uri $uri
return $result.results | % { Join-Path -Path $_.path -ChildPath $_.name }
}
function Get-Workspace {

Keybase proof

I hereby claim:

  • I am adamskt on github.
  • I am codesalad (https://keybase.io/codesalad) on keybase.
  • I have a public key ASDsfktYJZzFreOVpBc8ZRwu4URgBVZ2P2F0c7OigH1A_Qo

To claim this, I am signing this object: