chrome_downgrade.ps1

<#PSScriptInfo
 
.VERSION 1.0.2
 
.GUID 0662c546-4296-4873-ba63-2d160b33ad70
 
.AUTHOR c.dek.
 
.COMPANYNAME .
 
.COPYRIGHT 2021
 
.TAGS
Chrome,Downgrade,Uninstaller,Chrome Remover,Remover, Chrome Unininstaller,Chrome Downgrade
 
.LICENSEURI
 
.PROJECTURI
 
.ICONURI https://iconarchive.com/download/i64908/fruityth1ng/stark/Chrome-Old.ico
 
.EXTERNALMODULEDEPENDENCIES
 
.REQUIREDSCRIPTS
 
.EXTERNALSCRIPTDEPENDENCIES
 
.RELEASENOTES
Script used to downgrade chrome to earlier editions -and retain older version- as described on official documentation
 
.PRIVATEDATA
 
#>


<#
 
.DESCRIPTION
Script used to downgrade chrome to earlier editions (steps to proper downgrade
-and retain older version- as described on official documentation):
 
- Remove/Replace relevant registry entries.
- Uninstall chrome, re-install older version.
- Disable dependent update services to prevent future updates.
- Rename Google Local Updates folder (where applic).
 
*Updated* - Tested on windows 10 x64.
 
#>
 

Param()
<#
 # chrome_downgrade.ps1
 #
 # Script used for downgrading current chrome installation to earlier instances (recommended up to v83+).
 #
 # Used for renaming current system configuration and sets
 # appropriate setting for using chrome with older version.
 #
 # WARNING: This script also will disable any future updates on chrome
 # so that the downgraded version is locked to the latest installation.
 #
 # Just run the ps1 file from the command line to perform required operations.
 #
 # Script does not need to run with administrative priviledge, elevation
 # is triggered where appropriate (with user interaction).
 #
 #>



Write-Host -ForegroundColor DarkYellow -BackgroundColor Black "Downgrading x86 - Chrome Instance..`r`n" -Verbose;
Write-Warning -Message "[ $((Get-Date).Hour):$((Get-Date).Minute):$((Get-Date).Second) ]`tModifying file system for changes" -Verbose;
Start-Sleep 3;
Write-Host "..DONE.."
Write-Warning -Message "[ $((Get-Date).Hour):$((Get-Date).Minute):$((Get-Date).Second) ]`tUninstalling Chrome"

# Disable external updates for latest chrome installs..
Start-Sleep 2;
Write-Host -ForegroundColor DarkYellow -BackgroundColor Black "`r`nAdditional Registry Changes..";

# Disable updates main google policy per x64, x86 registry instance (s).
$regscript = @'
Windows Registry Editor Version 5.00
 
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Policies\Google\Update]
"AutoUpdateCheckPeriodMinutes"=dword:00000000
"DisableAutoUpdateChecksCheckboxValue"=dword:00000001
"UpdateDefault"=dword:00000000
"Update{8A69D345-D564-463C-AFF1-A69D9E530F96}"=dword:00000000
 
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Update]
"AutoUpdateCheckPeriodMinutes"=dword:00000000
"DisableAutoUpdateChecksCheckboxValue"=dword:00000001
"UpdateDefault"=dword:00000000
"Update{8A69D345-D564-463C-AFF1-A69D9E530F96}"=dword:00000000
'@
;

# bulk entries import via command line..
$regscript | Add-content -Path ".\chrome_update_remove.reg" | Out-Null;
$is64bit = (Get-WmiObject -Class Win32_ComputerSystem).SystemType -match "(x64)"

if ($is64bit) {
Start-Process powershell -Verb runAs ". {reg import $env:USERPROFILE\Downloads\chrome_update_remove.reg /reg:64}" -PassThru | Out-Null
Start-Sleep 1;
del ".\chrome_update_remove.reg";
 } else {
Start-Process powershell -Verb runAs ". {reg import $env:USERPROFILE\Downloads\chrome_update_remove.reg /reg:32}" -PassThru | Out-Null
Start-Sleep 1;
del ".\chrome_update_remove.reg";
}

$version = $((Get-ItemProperty -Path "$(PSDrive | ?{$_.Name -eq "HKLM"}):\Software\WOW6432Node\Google\Update\Clients\*" | ?{$_.Name -eq "Google Chrome"}).pv);
Write-Host "Uninstalling Chrome version [ $($version) ]..";
try {
Start-Process "${env:ProgramFiles(x86)}\Google\Chrome\Application\${version}\Installer\setup.exe" -ArgumentList ("--uninstall","--system-level");
}
Catch { # on exception or error, alternative uninstall..
Write-Error "<<< Error on Uninstalling via setup directory, re-trying alternate uninstall. >>>";
Start-Process chrome.exe -ArgumentList @("--uninstall","--force-uninstall")
}

# Preload download options from external site.
$AllContent = Invoke-WebRequest -Uri "https://www.slimjet.com/chrome/google-chrome-old-version.php" -UseBasicParsing -Method Get

# Selection list numbered.
$r=0;
$AllContent.Links | ?{$_ -ilike "*.exe*"} | %{
$_ | Add-Member -Name Selection -Value $($r) -MemberType NoteProperty -Force;
$_.href = $_.href;
$_.tagName = ($_.tagName).toLower() -replace "<","" -replace ">","";
$_.outerHTML = $_.outerHTML -replace "[^0-9]+`.{1}[^0-9]+`.{1}[^0-9]+`.{1}[^0-9]+","" -replace "`'`>"," @ Version " -replace "</a>","";
 $r++;
}

Write-Host -Foreground Red -Background Yellow "[ Content gathered from slimjet.com ] - LIST OF CHROME DOWNLOADS";
$dload = $AllContent.Links | ?{$_ -ilike "*.exe*"}
$dload | Format-Table -AutoSize
$sel = Read-Host -Prompt "Please make your selection from the list above: ";

[int]$sel = ($sel -as [int]);
$finurl = ($($dload[$sel]).href -split "=")[1] -replace "%2F","`/";
$execload = ($(($dload[($sel)]).href) -split "%2F")[1];
$selUrl = "https://www.slimjet.com/chrome/$($finurl)";

# Download chrome, downgrade pack..
Start-Job -ScriptBlock {
Start-Process -FilePath "msedge.exe" -ArgumentList @($using:selUrl,"--/prefetch:5") -Wait -ErrorAction SilentlyContinue;
} | Get-Job | Wait-Job -Any | Receive-Job;

# Install chrome downgrade pack..
Start-Job -ScriptBlock {
$latestfile = (Get-ChildItem -Path "$env:USERPROFILE\Downloads\" -Filter "*.exe" | Sort LastWriteTime -descending | Select -First 1).Name
if ($latestfile -ne "${using:execload}") { ren $latestfile "${using:execload}" -ErrorAction SilentlyContinue }
Start-Process -FilePath "${env:USERPROFILE}\Downloads\$latestfile" -NoNewWindow -Wait -ErrorAction SilentlyContinue;
} | Get-Job | Wait-Job | Receive-Job;

Start-Job -ScriptBlock {
# Stop\Disable running services for Chrome Updater(s) - Total of 4 services.
$services = @("GoogleChromeElevationService","gupdate","gupdatem","gusvc");
$services  | %{
 Start-Process sc -Verb runAs -ArgumentList @("stop", "$($_)");
 Start-Process sc -Verb runAs -ArgumentList @("config","$($_)","start=disabled");
 }
} | Get-Job | Wait-Job | Receive-Job;


Get-Process Google* | Stop-Process -Force;
Get-Process chrome | Stop-Process -Force;
# Rename local updates folder
ren "${env:ProgramFiles(x86)}\Google\Update" "Update_OLD"