Last active
February 20, 2023 15:50
-
-
Save Snaver/39bdd480ee83a6d6fff71c7120136728 to your computer and use it in GitHub Desktop.
Google Chrome Uninstaller - PowerShell (Local install)
This file contains hidden or 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
# 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 | |
} |
This file contains hidden or 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
# $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