Created
May 19, 2020 07:19
-
-
Save stevecharon/a94554b7318d8a06d4a9014f951ede7f to your computer and use it in GitHub Desktop.
Get latest Google Chrome versions from public JSON feed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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