Skip to content

Instantly share code, notes, and snippets.

@Snaver
Last active February 20, 2023 15:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Snaver/39bdd480ee83a6d6fff71c7120136728 to your computer and use it in GitHub Desktop.
Save Snaver/39bdd480ee83a6d6fff71c7120136728 to your computer and use it in GitHub Desktop.
Google Chrome Uninstaller - PowerShell (Local install)
# Based on https://sccmentor.com/2021/01/11/using-proactive-remediations-to-remove-google-chrome/
# Thank you.
try
{
$chromeInstalled = Test-Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe'
if ($chromeInstalled -eq 'True') {
Write-Host "Google Chrome is installed locally"
exit 1
}
else {
#No remediation required
Write-Host "Google Chrome is not installed locally"
exit 0
}
}
catch {
$errMsg = $_.Exception.Message
Write-Error $errMsg
# exit 1
}
# $Chrome = Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName -match $($AppName)}
# $Chrome.UninstallString
$chromeInstalled = (Get-Item (Get-ItemProperty 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe' -ErrorAction SilentlyContinue).'(Default)').VersionInfo
$ChromeVersion = $chromeInstalled.ProductVersion
$Installer = "$env:LOCALAPPDATA\Google\Chrome\Application\$ChromeVersion\Installer\setup.exe"
$Arguements = "--uninstall --force-uninstall"
Start-Process $Installer $Arguements -Wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment