I’m trying to get the version of the Slide Agent for a dynamic version script, but the only reliable place to retrieve it seems to be the file version or product version of the EXE installer available at a publicly available URL. The default Get-DynamicVersionFromInstallerURL returns 0.0.0.1 instead of the actual version shown when you right-click the installer and choose “Properties”. Any insight?
Getting the same issue on my end.
I was able to work my way around that by doing this
function Resolve-RedirectUrl {
param ($Url)
$currentUrl = $Url
for ($i = 0; $i -lt 5; $i++) {
try {
$resp = Invoke-WebRequest -Uri $currentUrl -MaximumRedirection 0 -ErrorAction Stop
return $currentUrl
} catch {
$resp = $_.Exception.Response
$location = $resp.Headers.Location
if (-not $location) {
return $currentUrl
}
# Handle relative redirects
if ($location -notmatch '^https?://') {
$uri = [System.Uri]$currentUrl
$location = "$($uri.Scheme)://$($uri.Host)$location"
}
$currentUrl = $location
}
}
return $currentUrl
}
$realUrl = Resolve-RedirectUrl “installer_URL_”
$realUrl
Get-DynamicVersionFromUriRedirect $realURL