Skip to content

Instantly share code, notes, and snippets.

@stevecharon
Created May 19, 2020 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevecharon/a94554b7318d8a06d4a9014f951ede7f to your computer and use it in GitHub Desktop.
Save stevecharon/a94554b7318d8a06d4a9014f951ede7f to your computer and use it in GitHub Desktop.
Get latest Google Chrome versions from public JSON feed
Function Get-ChromeVersion {
[CmdletBinding()]
Param (
[Parameter(Mandatory = $False)]
[string] $Uri = "https://omahaproxy.appspot.com/all.json",
[Parameter(Mandatory = $False)]
[ValidateSet('win', 'win64', 'mac', 'linux', 'ios', 'cros', 'android', 'webview')]
[string] $Platform = "win",
[Parameter(Mandatory = $False)]
[ValidateSet('stable', 'beta', 'dev', 'canary', 'canary_asan')]
[string] $Channel = "stable"
)
# Read the JSON and convert to a PowerShell object. Return the current release version of Chrome
$chromeVersions = (Invoke-WebRequest -uri $Uri).Content | ConvertFrom-Json
$output = (($chromeVersions | Where-Object { $_.os -eq $Platform }).versions | `
Where-Object { $_.channel -eq $Channel }).current_version
Write-Output $output
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment