mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
Improve Acrobat uninstall detection and script ref
Make Acrobat uninstaller detection more robust and update metadata to the new script ref. app_commander.go: clarify the error log when an app remains after uninstall. adobe_acrobat_pro_uninstall.ps1: support both "Adobe Acrobat (64-bit)" and "Adobe Acrobat DC (64-bit)", guard against missing DisplayName, and ensure publisher filtering is applied before matching. windows.json: bump uninstall_script_ref to c94fe3ab and replace the embedded ref with the updated uninstall script.
This commit is contained in:
parent
ef18d1e5f8
commit
95ac6ece71
3 changed files with 13 additions and 6 deletions
|
|
@ -100,7 +100,7 @@ func (ac *AppCommander) uninstallApp(ctx context.Context) bool {
|
|||
return false
|
||||
}
|
||||
if existance {
|
||||
ac.appLogger.ErrorContext(ctx, fmt.Sprintf("App version '%s' was found after uninstall", ac.Version))
|
||||
ac.appLogger.ErrorContext(ctx, fmt.Sprintf("App still present after uninstall (expected no match for version '%s' in programs)", ac.Version))
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# Locate Adobe Acrobat Pro uninstaller from registry and execute it silently
|
||||
# Locate Adobe Acrobat Pro uninstaller from registry and execute it silently.
|
||||
# DisplayName is "Adobe Acrobat DC (64-bit)" on DC installs and may be "Adobe Acrobat (64-bit)" on others.
|
||||
|
||||
$displayName = "Adobe Acrobat (64-bit)"
|
||||
$displayNames = @("Adobe Acrobat (64-bit)", "Adobe Acrobat DC (64-bit)")
|
||||
$publisher = "Adobe"
|
||||
|
||||
$paths = @(
|
||||
|
|
@ -12,7 +13,13 @@ $paths = @(
|
|||
$uninstall = $null
|
||||
foreach ($p in $paths) {
|
||||
$items = Get-ItemProperty "$p\*" -ErrorAction SilentlyContinue | Where-Object {
|
||||
$_.DisplayName -and ($_.DisplayName -eq $displayName -or $_.DisplayName -like "$displayName*") -and ($publisher -eq "" -or $_.Publisher -eq $publisher)
|
||||
$dn = $_.DisplayName
|
||||
if (-not $dn) { return $false }
|
||||
if ($publisher -ne "" -and $_.Publisher -ne $publisher) { return $false }
|
||||
foreach ($d in $displayNames) {
|
||||
if ($dn -eq $d -or $dn -like "$d*") { return $true }
|
||||
}
|
||||
$false
|
||||
}
|
||||
if ($items) { $uninstall = $items | Select-Object -First 1; break }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
},
|
||||
"installer_url": "https://trials.adobe.com/AdobeProducts/APRO/Acrobat_HelpX/win32/Acrobat_DC_Web_x64_WWMUI.zip",
|
||||
"install_script_ref": "f7f87d02",
|
||||
"uninstall_script_ref": "96f53707",
|
||||
"uninstall_script_ref": "c94fe3ab",
|
||||
"sha256": "e93e1bef99d88d722f6e78e56d9de17e8ea1b1fc75d05f1055839794010c0ee5",
|
||||
"default_categories": [
|
||||
"Productivity"
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
}
|
||||
],
|
||||
"refs": {
|
||||
"96f53707": "# Locate Adobe Acrobat Pro uninstaller from registry and execute it silently\n\n$displayName = \"Adobe Acrobat (64-bit)\"\n$publisher = \"Adobe\"\n\n$paths = @(\n 'HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',\n 'HKLM:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall',\n 'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall'\n)\n\n$uninstall = $null\nforeach ($p in $paths) {\n $items = Get-ItemProperty \"$p\\*\" -ErrorAction SilentlyContinue | Where-Object {\n $_.DisplayName -and ($_.DisplayName -eq $displayName -or $_.DisplayName -like \"$displayName*\") -and ($publisher -eq \"\" -or $_.Publisher -eq $publisher)\n }\n if ($items) { $uninstall = $items | Select-Object -First 1; break }\n}\n\nif (-not $uninstall -or -not $uninstall.UninstallString) {\n Write-Host \"Uninstall entry not found\"\n Exit 0\n}\n\n$acrobatProcesses = @(\"Acrobat\", \"AcroRd32\", \"RdrCEF\", \"AdobeCollabSync\")\nforeach ($proc in $acrobatProcesses) {\n Stop-Process -Name $proc -Force -ErrorAction SilentlyContinue\n}\n\n$uninstallCommand = $uninstall.UninstallString\n\nif ($uninstallCommand -match \"MsiExec\\.exe\\s+/[IX]\\s*(\\{[A-F0-9-]+\\})\") {\n $productCode = $Matches[1]\n $uninstallArgs = \"/X $productCode /qn /norestart\"\n $uninstallCommand = \"MsiExec.exe\"\n} else {\n Write-Host \"Error: Unable to parse uninstall command: $uninstallCommand\"\n Exit 1\n}\n\nWrite-Host \"Uninstall command: $uninstallCommand\"\nWrite-Host \"Uninstall args: $uninstallArgs\"\n\ntry {\n $processOptions = @{\n FilePath = $uninstallCommand\n ArgumentList = $uninstallArgs\n NoNewWindow = $true\n PassThru = $true\n Wait = $true\n }\n\n $process = Start-Process @processOptions\n $exitCode = $process.ExitCode\n\n Write-Host \"Uninstall exit code: $exitCode\"\n\n $timeout = 60\n $elapsed = 0\n while ((Get-Process -Name \"msiexec\" -ErrorAction SilentlyContinue) -and ($elapsed -lt $timeout)) {\n Start-Sleep -Seconds 2\n $elapsed += 2\n Write-Host \"Waiting for MsiExec to complete... ($elapsed seconds)\"\n }\n\n Exit $exitCode\n} catch {\n Write-Host \"Error running uninstaller: $_\"\n Exit 1\n}\n",
|
||||
"c94fe3ab": "# Locate Adobe Acrobat Pro uninstaller from registry and execute it silently.\n# DisplayName is \"Adobe Acrobat DC (64-bit)\" on DC installs and may be \"Adobe Acrobat (64-bit)\" on others.\n\n$displayNames = @(\"Adobe Acrobat (64-bit)\", \"Adobe Acrobat DC (64-bit)\")\n$publisher = \"Adobe\"\n\n$paths = @(\n 'HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',\n 'HKLM:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall',\n 'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall'\n)\n\n$uninstall = $null\nforeach ($p in $paths) {\n $items = Get-ItemProperty \"$p\\*\" -ErrorAction SilentlyContinue | Where-Object {\n $dn = $_.DisplayName\n if (-not $dn) { return $false }\n if ($publisher -ne \"\" -and $_.Publisher -ne $publisher) { return $false }\n foreach ($d in $displayNames) {\n if ($dn -eq $d -or $dn -like \"$d*\") { return $true }\n }\n $false\n }\n if ($items) { $uninstall = $items | Select-Object -First 1; break }\n}\n\nif (-not $uninstall -or -not $uninstall.UninstallString) {\n Write-Host \"Uninstall entry not found\"\n Exit 0\n}\n\n$acrobatProcesses = @(\"Acrobat\", \"AcroRd32\", \"RdrCEF\", \"AdobeCollabSync\")\nforeach ($proc in $acrobatProcesses) {\n Stop-Process -Name $proc -Force -ErrorAction SilentlyContinue\n}\n\n$uninstallCommand = $uninstall.UninstallString\n\nif ($uninstallCommand -match \"MsiExec\\.exe\\s+/[IX]\\s*(\\{[A-F0-9-]+\\})\") {\n $productCode = $Matches[1]\n $uninstallArgs = \"/X $productCode /qn /norestart\"\n $uninstallCommand = \"MsiExec.exe\"\n} else {\n Write-Host \"Error: Unable to parse uninstall command: $uninstallCommand\"\n Exit 1\n}\n\nWrite-Host \"Uninstall command: $uninstallCommand\"\nWrite-Host \"Uninstall args: $uninstallArgs\"\n\ntry {\n $processOptions = @{\n FilePath = $uninstallCommand\n ArgumentList = $uninstallArgs\n NoNewWindow = $true\n PassThru = $true\n Wait = $true\n }\n\n $process = Start-Process @processOptions\n $exitCode = $process.ExitCode\n\n Write-Host \"Uninstall exit code: $exitCode\"\n\n $timeout = 60\n $elapsed = 0\n while ((Get-Process -Name \"msiexec\" -ErrorAction SilentlyContinue) -and ($elapsed -lt $timeout)) {\n Start-Sleep -Seconds 2\n $elapsed += 2\n Write-Host \"Waiting for MsiExec to complete... ($elapsed seconds)\"\n }\n\n Exit $exitCode\n} catch {\n Write-Host \"Error running uninstaller: $_\"\n Exit 1\n}\n",
|
||||
"f7f87d02": "# Adobe Acrobat Pro: the download is a zip that contains both AcroPro.msi and setup.exe\n# (under \"Adobe Acrobat\\\"). Prefer the MSI for a standard silent install; fall back to setup.exe.\n\n$zipFilePath = \"${env:INSTALLER_PATH}\"\n\ntry {\n $extractPath = Join-Path $env:TEMP \"AdobeAcrobatProInstall\"\n\n if (Test-Path $extractPath) {\n Remove-Item -Path $extractPath -Recurse -Force\n }\n\n Expand-Archive -Path $zipFilePath -DestinationPath $extractPath -Force\n\n $msiPath = Join-Path $extractPath \"Adobe Acrobat\\AcroPro.msi\"\n if (-not (Test-Path $msiPath)) {\n $found = Get-ChildItem -Path $extractPath -Filter \"AcroPro.msi\" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1\n if ($found) { $msiPath = $found.FullName }\n }\n\n if (Test-Path $msiPath) {\n $msiArgs = @(\n \"/i\", \"`\"$msiPath`\"\",\n \"/qn\", \"/norestart\",\n \"EULA_ACCEPT=YES\"\n )\n $process = Start-Process -FilePath \"msiexec.exe\" -ArgumentList $msiArgs -PassThru -Wait -NoNewWindow\n $exitCode = $process.ExitCode\n Write-Host \"Install exit code (msiexec): $exitCode\"\n } else {\n $setupExe = Join-Path $extractPath \"Adobe Acrobat\\setup.exe\"\n if (-not (Test-Path $setupExe)) {\n Write-Host \"Error: Neither AcroPro.msi nor Adobe Acrobat\\setup.exe found under $extractPath\"\n Exit 1\n }\n $process = Start-Process -FilePath $setupExe -ArgumentList \"/sAll /rs /msi EULA_ACCEPT=YES\" -PassThru -Wait\n $exitCode = $process.ExitCode\n Write-Host \"Install exit code (setup.exe): $exitCode\"\n }\n\n Remove-Item -Path $extractPath -Recurse -Force -ErrorAction SilentlyContinue\n\n Exit $exitCode\n\n} catch {\n Write-Host \"Error: $_\"\n Exit 1\n}\n"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue