Skip to content

Instantly share code, notes, and snippets.

@rfennell
rfennell / ReleaseNotesWithFilter.ps1
Created August 23, 2016 11:01
How to add filters to release note generation
function Get-Mode
{
Param(
$line
)
$returnvalue = "" | Select-Object -Property mode, skipLogic
$mode = [Mode]::BODY
@rfennell
rfennell / RMTransform.cs
Last active December 20, 2016 16:41
Transform tool for transferring TFS 2015.3 Release Templates to VSTS
using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Linq;
namespace RMTransform
{
class Program
{
static void Main(string[] args)
@rfennell
rfennell / RemoveXAMLBuildController
Last active December 29, 2016 21:46
Tool to remove a XAML build controller from a VSTS instance
using Microsoft.TeamFoundation.Build.Client;
using Microsoft.TeamFoundation.Client;
using System;
using System.Linq;
// Needs the Nuget package Microsoft.TeamFoundationServer.ExtendedClient
namespace RemoveXAMLBuildController
{
class Program
{
@rfennell
rfennell / CommitToThisRepo.ps1
Created January 19, 2018 19:36
PowerShell script add a commit to the current repo for use inside a VSTS CI/CD process
(
$file = "readme.md",
$text = "Automated edit",
$wi = "#13 #14"
)
"Set config"
git config --global user.email "builduser@dummy.local" # any values will do, if missing commit will fail
git config --global user.name "Build user"
@rfennell
rfennell / Update-AppConfig.ps1
Created February 13, 2018 09:08
PowerShell script to update an app.config file based on a parameters.xml
function Update-AppConfig
{
[cmdletbinding()]
param
(
[parameter(Mandatory = $true, HelpMessage = "Name of app.exe.config file")]
[string]$AppConfigFile,
[parameter(Mandatory = $false, HelpMessage = "Name of parameters.xml file")]
[string]$ParametersFile = "parameters.xml"
param
(
[Parameter(Mandatory = $true)]
[string]$pat,
[Parameter(Mandatory = $true)]
[string]$instance,
[Parameter(Mandatory = $true)]
@rfennell
rfennell / Add-CapabilityToAgent.ps1
Last active January 29, 2021 09:27
A bit of PowerShell to add capabilities to a Azure DevOps Pipeline Agent programmatically
##-----------------------------------------------------------------------
## <copyright file="Add-CapabilityToAgent.ps1">(c) Tichard Fennell </copyright>
##-----------------------------------------------------------------------
# Adds capacility tags a Azure DevOps Pipeline agent
# Run in the agent folder
Param
(
[parameter(Mandatory=$true,HelpMessage="Personal Access Token with rights to manage agents")]
$patToken,
@rfennell
rfennell / Add-UserCapablitiesToAgent.ps1
Last active December 20, 2019 17:03
Poll for an Azure Build Agent to become available and when available then add capabilities
param
(
[parameter(Mandatory = $true, HelpMessage = "Azure DevOps PAT token")]
$pat,
[parameter(Mandatory = $true, HelpMessage = "URL of Azure DevOps instance e.g. https://dev.aure.com/myinstance")]
$url,
[parameter(Mandatory = $true, HelpMessage = "Azure DevOps Agent Pool name")]
$pool ,
[parameter(Mandatory = $true, HelpMessage = "Based name for agent to search for e.g MyAgent as part of B1MyAgent-123")]
$agentBaseName ,
@rfennell
rfennell / Copy-UserCapablityToAgent.ps1
Created December 20, 2019 17:03
Poll for an Azure Build Agent to become available and when available copy the capabilities
param
(
[parameter(Mandatory = $true, HelpMessage = "Azure DevOps PAT token")]
$pat,
[parameter(Mandatory = $true, HelpMessage = "URL of Azure DevOps instance e.g. https://dev.aure.com/myinstance")]
$url,
[parameter(Mandatory = $true, HelpMessage = "Azure DevOps Agent Pool name")]
$pool ,
[parameter(Mandatory = $true, HelpMessage = "Based name for agent to search for e.g MyAgent as part of B1MyAgent-123")]
$agentBaseName ,
@rfennell
rfennell / Unregister-Agent.ps1
Created December 20, 2019 17:09
Finds an Azure Build agent, takes it off line then removes it registration
param
(
[parameter(Mandatory = $true, HelpMessage = "Azure DevOps PAT token")]
$pat,
[parameter(Mandatory = $true, HelpMessage = "URL of Azure DevOps instance e.g. https://dev.aure.com/myinstance")]
$url,
[parameter(Mandatory = $true, HelpMessage = "Azure DevOps Agent Pool name")]
$pool ,
[parameter(Mandatory = $true, HelpMessage = "Based name for agent to search for e.g MyAgent as part of B1MyAgent-123")]
$agentBaseName ,