From 4cfb7828184545a7faa440a17f3fc1f2bf2c7cd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20W=C3=B6hrl?= Date: Fri, 28 Feb 2020 14:01:15 +0100 Subject: [PATCH] Added script to update agent version --- Source/Public/Update-VSTeamAgent.ps1 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Source/Public/Update-VSTeamAgent.ps1 diff --git a/Source/Public/Update-VSTeamAgent.ps1 b/Source/Public/Update-VSTeamAgent.ps1 new file mode 100644 index 000000000..05775b4b2 --- /dev/null +++ b/Source/Public/Update-VSTeamAgent.ps1 @@ -0,0 +1,22 @@ +function Update-VSTeamAgent { + param( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, Position = 0)] + [int] $PoolId, + + [parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Position = 1)] + [Alias('AgentID')] + [int[]] $Id + ) + + process { + foreach ($item in $Id) { + try { + _callAPI -Method Post -Area "distributedtask/pools/$PoolId" -Resource messages -QueryString @{agentId=$item} -Version $([VSTeamVersions]::DistributedTask) -ContentType "application/json" | Out-Null + Write-Output "Update agent $item" + } + catch { + _handleException $_ + } + } + } +} \ No newline at end of file