I want to Uninstall all versions of chrome present in environment before installing new version of Chrome in the environment.
What I am trying to do is I am querying machine at run time to give me installed GUID’s of Chrome and then match it with list of ver and then uninstall it accordingly using nested if statements.
But I am hitting a bottleneck here as I can’ t get array to compare and yield results any suggestions. If you have a better idea to do this, please suggest as well.
You can also do this… This works for any MSI application.
## uninstall all previous versions of bricsCAD before continuing
$GoogleCHrome = Get-InstalledApplication -Name 'Google Chrome' | Select -ExpandProperty UninstallString
if ($GoogleCHrome) {
foreach ($item in $GoogleCHrome)
{
$ChomeProductCode = $item -Replace "msiexec.exe","" -Replace "/I","" -Replace "/X",""
$ChomeProductCode = $ChomeProductCode.Trim()
Execute-MSI -Action 'Uninstall' -Path $ChomeProductCode -Parameters '/QN' -ContinueOnError $true
}
}
But know that the Google Chrome enterprise installer will just update, not matter what version is currently installed.
So not really required to uninstall first…
Yea, Aldin, That is exactly my challenge is, that uninstall chrome completely like ver and updater and all completely and then install my chrome enterprise ver 80.0.132.
Your script actually helped me to uninstall chrome on my machine, but when installing it again, gave me error on some machines like chrome msi installer ver is higher than the ver installed, not sure if that is depended on the fact that chrome enterprise actually has win installer different than chrome ver installed on machines.
If do a quick check of wmic product select query to get -name “Google” we can see that chrome will show chrome installer ver and its win installer ver with google updater ver.
Google Updater will sometimes uninstall with google chrome guid’s but sometimes chrome’s win installer ver guid does not uninstall, which actually poses issue when installing chrome on a machine.
Then I have to use MS Uninstaller for stuck installation tools to remove product msi and guid;'s from affected machines to fix the issue.
What I am trying to build is a silent version for a single application tool which can do this task for me so that we can avoid such issues with stuck installations.
I tried using your option but it gave me “” [03-05-2020 16:09:45.564] [Post-Uninstallation] [Remove-MSIApplications] :: Skipping removal of application [Google Chrome] because uninstall string [] does not match “msiexec”.""
I know your script can help me, this maybe some issue with machine in my environment only.
Can you help me to enable logging on every step so that I can know where exactly is calling what and doing what.
I tried running your script in a script block it just says :
Logging is enabled by default.
In my environment I changed the path for the log files to be all in the same location.
You can do the same by editing the Config file of the toolkit
“\Toolkit\AppDeployToolkit\AppDeployToolkitConfig.xml”
Check this to see where log files are written to or change to something else if you don’t like it:
<Toolkit_LogPath>C:\Logfiles</Toolkit_LogPath>
You can add your own custom log entries for each step with:
Write-Log "Starting “Your text” -Source “YourName”
However, each step that the toolkit does is logged by default. Your custom log entries may help to quickly identify where your script is at.
The -Source parameter is optional, but entering here something (like your name) will help you to easily find the entry in the log file when viewing it in CMTrace.
You’ll find whatever you typed in there as the “Component” in CMTrace.
That being said…
The script does uninstall all chrome versions on my test devices. So I’m pretty sure it works.
When I have gone and checked this location can’t find this “4ac78fdf.msi” at installer location.
I tried restarting machine as well, it still does not work.
I have kept the code in pre-installation stage, should I be keeping it at some other location? Please suggest.
Google Chrome MSI Installer has two GUID’s one is Win Installer Guid and other is google Chrome guid, when you check it with wmic product select query command for ‘google’ you can find both guid;s which you can’t find easily on your machine, Which is causing issues in clean installation of chrome on machine, because if you clean Google Chrome msi you would still have or chances of leaving old guid’s of win installer associated with chrome.
The script checks the uninstall string associated with the installed product, whether it’s an MSI or the EXE installer and runs the appropriate uninstaller depending of how it was installed. So that won’t be a problem.
I’m not sure what the issue now is to be honest. Above log file is incomplete.
Does the script get stuck?
You have the Verbose log file from the MSI (which I suppose above log is from) and you have the log file of the toolkit itself.
In the PSADT log file you can see each action it’s executing.
What you have to do is querying the HKLM\Software\Microsoft\Windows\Currentversion\uninstall for the displayname with Google Chrome. The get the uninstall commandline. No need for a list.