Created
May 18, 2021 15:52
-
-
Save dpo007/bb16a413bc1c15ff0a58f496ebc17032 to your computer and use it in GitHub Desktop.
PowerShell :: Uninstall User-level Chrome install (ie: log on script)
This file contains 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
$chromeFolder = Join-Path $env:LOCALAPPDATA '\Google\Chrome' | |
$setupPath = Join-Path $chromeFolder '\Application\*.*\Installer\setup.exe' | |
# Use setup.exe from most recent version folder found. | |
if ((gci $setupPath).Count -gt 1) { | |
$setupPath = gci $setupPath | sort -Descending | |
$setupPath = $setupPath[0] | |
} | |
$argList = '--uninstall --multi-install --chrome --force-uninstall' | |
try { | |
Start-Process -FilePath $setupPath -ArgumentList $argList -Wait -NoNewWindow -PassThru | |
} catch { | |
throw ('Error uninstalling Chrome: {0}' -f $_.Exception.Message) | |
} | |
Remove-Item -Path $chromeFolder -Recurse -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment