Closed severud closed 2 years ago
I modified the code to get the current version and redirected path from aka.ms/fslogix/download as follows:
function Get-FSLogixOnline { <# .SYNOPSIS Returns latest Version and Uri for FSLogix #> Function Get-RedirectedUrl { Param ( [Parameter(Mandatory = $true)] [String]$url ) $request = [System.Net.WebRequest]::Create($url) $request.AllowAutoRedirect = $true try { $response = $request.GetResponse() $response.ResponseUri.AbsoluteUri $response.Close() } catch { "ERROR: $_" } } try { $ProgressPreference = 'SilentlyContinue' $url = Get-RedirectedUrl -URL 'https://aka.ms/fslogix/download' # grab version $Version = ($url.Split("/")[-1] | Select-String -Pattern "(\d+(\.\d+){1,4})" -AllMatches | ForEach-Object { $_.Matches } | ForEach-Object { $_.Value }).ToString() # return evergreen object return @{ Version = $Version; URI = $url } } catch { Throw $_ } } Function Get-RedirectedUrl { Param ( [Parameter(Mandatory = $true)] [String]$url ) $request = [System.Net.WebRequest]::Create($url) $request.AllowAutoRedirect = $true try { $response = $request.GetResponse() $response.ResponseUri.AbsoluteUri $response.Close() } catch { "ERROR: $_" } } try { $ProgressPreference = 'SilentlyContinue' $url = Get-RedirectedUrl -URL 'https://aka.ms/fslogix/download' # grab version $Version = ($url.Split("/")[-1] | Select-String -Pattern "(\d+(\.\d+){1,4})" -AllMatches | ForEach-Object { $_.Matches } | ForEach-Object { $_.Value }).ToString() # return evergreen object return @{ Version = $Version; URI = $url } } catch { Throw $_ } }
Thanks! More robust way to get a redirected Url.
Fixed in 2107.1
I modified the code to get the current version and redirected path from aka.ms/fslogix/download as follows: