Skip to content

Instantly share code, notes, and snippets.

View michael-baker's full-sized avatar

Michael Baker michael-baker

  • Wanganui, New Zealand
View GitHub Profile
@michael-baker
michael-baker / tune_ps2.ps1
Last active April 4, 2022 06:07
Apply an Intel XTU profile from PowerShell
# Must be run under 32-bit PowerShell as ProfilesApi is x86
[System.Reflection.Assembly]::LoadFrom("C:\Program Files (x86)\Intel\Intel(R) Extreme Tuning Utility\Client\ProfilesApi.dll") | Out-Null
# This script programmatically applies an Intel XTU profile.
# This script can replace the CLI method outlined here: https://www.reddit.com/r/Surface/comments/3vslko/change_cpu_voltage_offset_with_intel_xtu_on/
[ProfilesApi.XtuProfileReturnCode]$applyProfileResult = 0
$profileApi = [ProfilesApi.XtuProfiles]::new()
$profileApi.Initialize() | Out-Null
@michael-baker
michael-baker / QueryCscVersion.ps1
Created September 7, 2021 09:23
Query Build Visual Studio 2019 CSC Version on TFS 2018 Agents
# This script finds all build agents for TFS 2018 in the "default" pool and then executes CSC --version for Visual Studio 2019
# against that agent.
# Get all pools
$pools = Invoke-RestMethod -UseDefaultCredentials -Method Get -Uri "https://tfs.com/tfs/_apis/distributedtask/pools" -UseBasicParsing
# Find the ID of the pool we want
$id = $pools.value | Where-Object { $_.name -eq "Default" } | Select-Object -ExpandProperty id -Unique
$agents = Invoke-RestMethod -UseDefaultCredentials -Method Get -Uri "https://tfs.com/tfs/_apis/distributedtask/pools/$id/agents?includeCapabilities=false&includeAssignedRequest=true"
@michael-baker
michael-baker / UpdateVisualStudio2019.ps1
Created September 7, 2021 09:27
TFS Build Agent - Update Visual Studio 2019 Installation
# This script queries the default agent pool, gets all agents in that pool
# and executes setup.exe (Visual Studio Installer) and begins a silent update of Visual Studio 2019
# For TFS 2018
# Get all pools
$pools = Invoke-RestMethod -UseDefaultCredentials -Method Get -Uri "https://tfs.com/tfs/_apis/distributedtask/pools" -UseBasicParsing
# Find the ID of the pool we want
$id = $pools.value | Where-Object { $_.name -eq "Default" } | Select-Object -ExpandProperty id -Unique
@michael-baker
michael-baker / RemoveLegacyCsProjElementsAndAttributes.ps1
Last active September 9, 2021 03:33
Remove legacy CS Project elements and attributes
Param(
[Parameter(Mandatory=$true,
ValueFromPipeline=$true)]
[String[]]
$Path
)
$ErrorActionPreference = 'Stop'
$projs = gci -Path $Path -Filter *.csproj -Recurse