Skip to content

Instantly share code, notes, and snippets.

@dpo007
Created May 18, 2021 15:52
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 dpo007/bb16a413bc1c15ff0a58f496ebc17032 to your computer and use it in GitHub Desktop.
Save dpo007/bb16a413bc1c15ff0a58f496ebc17032 to your computer and use it in GitHub Desktop.
PowerShell :: Uninstall User-level Chrome install (ie: log on script)
$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