Skip to content

Instantly share code, notes, and snippets.

@adotcoop
Last active July 12, 2021 11:08
Show Gist options
  • Save adotcoop/afafbf0663263c88e1ab1b86e3cfc8b8 to your computer and use it in GitHub Desktop.
Save adotcoop/afafbf0663263c88e1ab1b86e3cfc8b8 to your computer and use it in GitHub Desktop.
Get version and url for tableau products using url redirects
# version match regex
$matchversion = "(\d+(\-\d+){1,3})"
# tableau reader
$tr = Invoke-WebRequest -UseBasicParsing -Uri "https://www.tableau.com/downloads/reader/pc64" -MaximumRedirection 0 -ErrorAction Ignore
$trversion = [RegEx]::Match($tr.Headers.Location, $matchversion) | Select-Object -ExpandProperty Value -Unique
$tr.Headers.Location
$trversion.Replace('-','.')
# tableau desktop
$td = Invoke-WebRequest -UseBasicParsing -Uri "https://www.tableau.com/downloads/desktop/pc64" -MaximumRedirection 0 -ErrorAction Ignore
$tdversion = [RegEx]::Match($td.Headers.Location, $matchversion) | Select-Object -ExpandProperty Value -Unique
$td.Headers.Location
$tdversion.Replace('-','.')
# tableau prep
$tp = Invoke-WebRequest -UseBasicParsing -Uri "https://www.tableau.com/downloads/prep/pc64" -MaximumRedirection 0 -ErrorAction Ignore
$tpversion = [RegEx]::Match($tp.Headers.Location, $matchversion) | Select-Object -ExpandProperty Value -Unique
$tp.Headers.Location
$tpversion.Replace('-','.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment