diff --git a/package/tools/chocolateyinstall.ps1 b/package/tools/chocolateyinstall.ps1 index a4b7e46..b6d5cf3 100644 --- a/package/tools/chocolateyinstall.ps1 +++ b/package/tools/chocolateyinstall.ps1 @@ -222,6 +222,28 @@ else { } } +# verify the 64 bit installation, if the update is not found attempt a second update +[array]$32_or_64bitsoftware = get-itemproperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' +[array]$32_on_64bitsoftware = get-itemproperty 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' +$installedProducts = [system.linq.enumerable]::union([object[]]$32_or_64bitsoftware, [object[]]$32_on_64bitsoftware) +if (($installedProducts | Where-Object {(($_.DisplayName -contains 'Adobe Acrobat (64-bit)') -or ($_.DisplayName -contains 'Adobe Acrobat Reader')) -and ($_.DisplayVersion.replace('.', '') -eq $UpdaterVersion)} | measure).Count -lt 1){ + $UpdateArgs = @{ + Statements = "/p `"$mspPath`" /norestart /quiet ALLUSERS=1 EULA_ACCEPT=YES $options" + + " /L*v `"$env:TEMP\$env:chocolateyPackageName.$env:chocolateyPackageVersion.Reupdate.log`"" + ExetoRun = 'msiexec.exe' + validExitCodes = @(0, 1603) + } + $exitCode = Start-ChocolateyProcessAsAdmin @UpdateArgs + + if ($exitCode -eq 1603) { + Write-Warning "For code 1603, Adobe recommends to 'shut down Microsoft Office and all web browsers' and try again." + Write-Warning 'The update log should provide more details about the encountered issue:' + Write-Warning " $env:TEMP\$env:chocolateyPackageName.$env:chocolateyPackageVersion.Update.log" + Throw "Patching of $env:ChocolateyPackageName to the latest version was unsuccessful." + } +} + + if ($PackageParameters.NoUpdates -or $UpdateMode -lt 2) { Unregister-ScheduledTask 'Adobe Acrobat Update Task' -Confirm:$false -ErrorAction SilentlyContinue }