Skip to content

Instantly share code, notes, and snippets.

@changbowen
Created April 4, 2024 13:09
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 changbowen/a0d1ae9d4f5015ef15d8513ea0401991 to your computer and use it in GitHub Desktop.
Save changbowen/a0d1ae9d4f5015ef15d8513ea0401991 to your computer and use it in GitHub Desktop.
# Credits: https://squirrelistic.com/blog/how_to_download_older_version_of_google_chrome
$ChromeVersion = '123'
$requestId = ([String][Guid]::NewGuid()).ToUpper()
$sessionId = ([String][Guid]::NewGuid()).ToUpper()
$xml = @"
<?xml version="1.0" encoding="UTF-8"?>
<request protocol="3.0" updater="Omaha" sessionid="{$sessionId}"
installsource="update3web-ondemand" requestid="{$requestId}">
<os platform="win" version="10.0" arch="x64" />
<app appid="{8A69D345-D564-463C-AFF1-A69D9E530F96}" version="5.0.375"
ap="x64-stable-statsdef_0" lang="" brand="GCEB">
<updatecheck targetversionprefix="$ChromeVersion"/>
</app>
</request>
"@
$webRequest = @{
Method = 'Post'
Uri = 'https://tools.google.com/service/update2'
Headers = @{
'Content-Type' = 'application/x-www-form-urlencoded'
'X-Goog-Update-Interactivity' = 'fg'
}
Body = $Xml
}
$result = Invoke-WebRequest @webRequest -UseBasicParsing
$contentXml = [xml]$result.Content
$status = $contentXml.response.app.updatecheck.status
if ($status -eq 'ok') {
$package = $contentXml.response.app.updatecheck.manifest.packages.package
$urls = $contentXml.response.app.updatecheck.urls.url | ForEach-Object { $_.codebase + $package.name }
Write-Output "--- Chrome Windows 64-bit found. Hash=$($package.hash) Hash_sha256=$($package.hash_sha256)). ---"
Write-Output $urls
}
else {
Write-Output "Chrome not found (status: $status)"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment