-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added script to update agent version
- Loading branch information
Lukas Wöhrl
committed
Feb 28, 2020
1 parent
edd6d6e
commit 4cfb782
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 $_ | ||
} | ||
} | ||
} | ||
} |