ConfigMgr – Remove Google Chrome with batch-file .cmd
I got an assignment. Remove Google Chrome completely from all computers in the organisation. Even if it’s user-based (aka not admin-installed but user-based)
Chrome can be installed in many different way:
- User-based (AppData\Local)
- msi-based (msiexec /i googleenterprise.msi /passive /norestart)
- other-thingie-based (where there’s a setup.exe ensuring updates, I think)
The last one and user-based are tricky, when wanting to uninstall every Chrome in the organisation, because the uninstaller is always inside a version-folder, so I did this:
For user-uninstallation, I need to iterate every user on the pc:
FOR /D %%X IN ("%SYSTEMDRIVE%\Users\*") DO ( DO /D %%Y IN ("%%X\Local\Google\Chrome\Application\*") DO ( "%%Y\Installer\setup.exe" --uninstall --multi-install --chrome --msi --force-uninstall )
and then there might be a system-level installation in both 64-bit and 32-bit folders of Program Files:
SET SRC1=%ProgramFiles%\Google\Chrome\Application SET SRC2=%ProgramFiles(x86)%\Google\Chrome\Application FOR %%X IN ("%SRC1%\*") DO ( "%%X\Installer\setup.exe" --uninstall --multi-install --chrome --msi --system-level -force-uninstall ) FOR %%X IN ("%SRC2%\*") DO ( "%%X\Installer\setup.exe" --uninstall --multi-install --chrome --msi --system-level -force-uninstall )
This way it’ll be uninstalled, if there are any user-level installation, and system-wide-installation. You can also do the usual msiexec /x GUID /quiet /norestart but, well. yeah, it’ll not always uninstall everything.
Google Chrome Portable is a totally other story. Haven’t figured that out yet…. AppLocker?