-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGet-OnlineVerGoogleChrome.ps1
More file actions
129 lines (108 loc) · 4.77 KB
/
Copy pathGet-OnlineVerGoogleChrome.ps1
File metadata and controls
129 lines (108 loc) · 4.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<#
===========================================================================
Created with: ISE 22621
Revision: v4
Last Modified: 02 October 2025
Created by: Jay Harper (github.com/thecatdidit/powershellusefulscripts)
Organizaiton: Happy Days Are Here Again
Filename: Get-OnlineVerGoogleChrome.ps1
===========================================================================
.CHANGELOG
v4 [02 October 2025]
Corrected download links for the MSI installers - x86 and x64 flavors
v3 [02 August 2024]
Update source and filter logic to reflect site content changes
v2 [09 April 2024]
Update release tracker source and filter logic
v1 [27 July 2021]
Script creation
.SYNOPSIS
This script queries details on the latest release of Google Chrome.
.DESCRIPTION
Release information is obtained from Chromium Dev Team's release tracker
https://chromiumdash.appspot.com/releases?platform=Windows
.EXAMPLE
PS> Get-OnlineVerGoogleChrome
Software_Name : Google Chrome
Software_URL : https://versionhistory.googleapis.com/v1/chrome/platforms/win64/channels/stable/versions/all/releases?filter=endtime=none
Online_Version : 127.0.6533.89
Online_Date : 2024-08-01
Download_URL_x86 : https://dl.google.com/dl/chrome/install/googlechromestandaloneenterprise64.msi
Download_URL_x64 : https://dl.google.com/dl/chrome/install/googlechromestandaloneenterprise.msi
PS> Get-GetOnlineVerGooglechrome -Quiet
127.0.6533.89
.INPUTS
-Quiet
Use of this parameter will output just the current version of
Chrome instead of the entire object. It will always be the
last parameter
.OUTPUTS
An object containing the following:
Software Name: Name of the software
Software URL: The URL info was sourced from
Online Version: The current version found
Online Date: The date the version was updated
Download URL x64: Direct download link for the x64 version
Download URL x86: Direct download link for the x86 version
If -Quiet is specified then just the value of 'Online Version'
will be displayed.
.NOTES
Resources/Credits:
https://github.com/itsontheb
#>
function Get-OnlineVerGoogleChrome {
[cmdletbinding()]
param (
[Parameter(Mandatory = $false,
Position = 0)]
[switch]
$Quiet
)
begin {
# Initial Variables
$SoftwareName = 'Google Chrome'
$URI = 'https://versionhistory.googleapis.com/v1/chrome/platforms/win64/channels/stable/versions/all/releases?filter=endtime=none'
$hashtable = [ordered]@{
'Software_Name' = $softwareName
'Software_URL' = $uri
'Online_Version' = 'UNKNOWN'
'Online_Date' = 'UNKNOWN'
'Download_URL_x86' = 'UNKNOWN'
'Download_URL_x64' = 'UNKNOWN'
}
$swObject = New-Object -TypeName PSObject -Property $hashtable
}
Process {
# Get the Version & Release Date
try {
Write-Verbose -Message "Attempting to pull info from the below URL: `n $URI"
$ReleaseInfo = ((Invoke-WebRequest -Uri $URI).content) | ConvertFrom-Json
$ReleaseVersion = $ReleaseInfo.releases[0].version
$ReleaseDate = ($ReleaseInfo.releases[0].serving.startTime).Substring(0,10)
$swObject.Online_Version = $ReleaseVersion
$swObject.Online_Date = $ReleaseDate
}
catch {
Write-Verbose -Message "Error accessing the below URL: `n $URI"
$message = $("Line {0} : {1}" -f $_.InvocationInfo.ScriptLineNumber, $_.exception.message)
$swObject | Add-Member -MemberType NoteProperty -Name 'ERROR' -Value $message
}
finally {
# Get the Download URLs
if ($swObject.Online_Version -ne 'UNKNOWN') {
$swObject.Download_URL_x86 = "https://dl.google.com/dl/chrome/install/googlechromestandaloneenterprise.msi"
$swObject.Download_URL_x64 = "https://dl.google.com/dl/chrome/install/googlechromestandaloneenterprise64.msi"
}
}
}
End {
# Output to Host
if ($Quiet) {
Write-Verbose -Message '$Quiet was specified. Returning just the version'
Return $swObject.Online_Version
}
else {
Return $swobject
}
}
} # END Function Get-OnlineVerGoogleChrome