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 / 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 / Update-LabilityRegistration.ps1
Created December 20, 2019 17:22
Registers a VHD disk image with Lability
param (
[parameter(Mandatory = $true, HelpMessage = "Name of the Lablity enviroment definition")]
$mediaid ,
[parameter(Mandatory = $true, HelpMessage = "UNC path the VHDs are stored on")]
$downloadPath
)
$metadataFiles = Get-ChildItem -Path $downloadPath -filter *.metadata
foreach ($file in $metadataFiles) {
@rfennell
rfennell / Remove-LabilityEnviroment.ps1
Last active January 6, 2020 14:16
Calculates the parameters and then removes a Lability environment
param
(
[parameter(Mandatory = $true, HelpMessage = "Lability environment name")]
$environmentName ,
[parameter(Mandatory = $true, HelpMessage = "An idenfication leter)]
$prefix,
[parameter(Mandatory = $true, HelpMessage = "Used as an index for the prefix and to calculate the IP address ")]
$index,
)
@rfennell
rfennell / Create-LabilityEnvironment.ps1
Last active January 6, 2020 14:17
Creates a new Lability Environment for an Azure DevOps build agent
param
(
[parameter(Mandatory = $true, HelpMessage = "Admin user name for new VM")]
$AgentUser,
[parameter(Mandatory = $true, HelpMessage = "Admin passworduser name for new VM")]
$AgentPassword,
[parameter(Mandatory = $true, HelpMessage = "Azure DevOps PAT token")]
$pat,
[parameter(Mandatory = $true, HelpMessage = "URL of Azure DevOps instance t register agent on e.g. https://dev.aure.com/myinstance")]
param
(
[Parameter(Mandatory = $true)]
[string]$pat,
[Parameter(Mandatory = $true)]
[string]$instance,
[Parameter(Mandatory = $true)]
@rfennell
rfennell / BuildAgent.ps1
Last active January 20, 2021 13:43
A Lability definition to create an Azure DevOps Agent
configuration BuildAgent {
param (
[ValidateNotNull()]
[System.Management.Automation.PSCredential]$Credential,
[string]$EnvPrefix,
[Int]$RetryCount = 100,
[Int]$RetryIntervalSec = 30
)