Skip to content

Instantly share code, notes, and snippets.

View pietergheysens's full-sized avatar

Pieter Gheysens pietergheysens

View GitHub Profile
@pietergheysens
pietergheysens / azurepipeline
Created April 16, 2021 13:42
Yaml pipeline with variable template
pool:
vmImage: ubuntu-latest
resources:
repositories:
- repository: sharedconfig
type: git
name: SharedConfiguration
variables:
@pietergheysens
pietergheysens / AsOfWiqlQueryToFixIterationPath.ps1
Created January 10, 2020 15:49
Fix Iteration Path of work items based on values of the as of parameter in a Azure DevOps WIQL query
$token = ""
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "azdo",$token)))
$uri = "https://dev.azure.com/{organisation}/{teamproject}/_apis/wit/wiql?api-version=5.1"
$body = @"
{
"query": "Select [System.Id], [System.Title], [System.State] From WorkItems
Where [System.TeamProject] = {teamproject} AND [System.WorkItemType] <> 'Test Case'
asof '2020-01-08T10:00:00.000Z'"}
@pietergheysens
pietergheysens / CreateVSALMVMs.ps1
Created January 3, 2018 16:28
Create Visual Studio ALM Virtual Machines based on specialized vhd file in Microsoft Azure
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId "<yoursubscriptionid>"
$destinationResourceGroup = Read-Host -Prompt "What's the desired resource group name?"
$numberOfVMs = Read-Host -Prompt "How many VMs do you want to generate?"
$location = "West Europe"
$vmSize = "Standard_F4s_v2"
$accountType = "PremiumLRS"
@pietergheysens
pietergheysens / Program.cs
Created September 12, 2016 14:56
Move inline images of work item description field to VSTS
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
Param(
[Parameter(Mandatory=$true)]
[string] $PATPassword
)
$username = "POC-GetBuildDetails"
$basicAuth = ("{0}:{1}" -f $username,$PATPassword)
$basicAuth = [System.Text.Encoding]::UTF8.GetBytes($basicAuth)
$basicAuth = [System.Convert]::ToBase64String($basicAuth)
@pietergheysens
pietergheysens / DestroyDeletedBranchesInTFS.ps1
Created January 13, 2016 11:16
Destroy deleted branches in TFS
Write-Host "*** Find deleted branches in TFS and destroy if not used in last 100 days ***" -ForegroundColor Yellow
Add-PSSnapin Microsoft.TeamFoundation.PowerShell
$tfsServer = Get-TfsServer -name http://<tfsserver>:8080/tfs/<tpccollection>
$destroyList = get-tfschilditem -item <versioncontrolpath> -server $tfsServer -Deleted | Where {$_.DeletionId -ne 0 -and $_.CheckinDate -lt (Get-Date).AddDays(-100)}
$deletedBranchesFound = $destroyList.Count
Write-Verbose "Found $deletedBranchesFound deleted branches for starting the destroy command ..." -Verbose
function Update-AssemblyInfoVersionFiles
{
Param
(
[Parameter(Mandatory=$true)]
[string]$productVersion
)
$buildNumber = $env:BUILD_BUILDNUMBER
if ($buildNumber -eq $null)