Skip to content

Commit

Permalink
fixed bug where windows files could not be found
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Allison authored and Mark Allison committed Jul 3, 2018
1 parent d9646cb commit 4ef6326
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 201-vm-vsts-agent/scripts/InstallVstsAgent.ps1
Expand Up @@ -51,7 +51,8 @@ do
Write-Verbose "Trying to get download URL for latest VSTS agent release..."
$latestRelease = Invoke-RestMethod -Uri "https://api.github.com/repos/Microsoft/vsts-agent/releases"
$latestRelease = $latestRelease | Where-Object assets -ne $null | Sort-Object created_at -Descending | Select-Object -First 1
$latestReleaseDownloadUrl = ($latestRelease.assets | ? { $_.name -like "*win-x64*" }).browser_download_url
$assetsURL = ($latestRelease.assets).browser_download_url
$latestReleaseDownloadUrl = ((Invoke-RestMethod -Uri $assetsURL) -match 'win').downloadurl
Invoke-WebRequest -Uri $latestReleaseDownloadUrl -Method Get -OutFile "$agentTempFolderName\agent.zip"
Write-Verbose "Downloaded agent successfully on attempt $retries" -verbose
break
Expand Down

0 comments on commit 4ef6326

Please sign in to comment.