You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

如何通过PowerShell脚本无交互卸载32位Adobe Acrobat Reader并通过Intune切换至64位版本

如何通过PowerShell脚本无交互卸载32位Adobe Acrobat Reader并通过Intune切换至64位版本

嘿,我完全懂你的处境——非Intune部署的软件没法用Intune自带的卸载功能,而且明明加了/quiet参数,脚本还是弹出修复/卸载的确认窗口,这确实闹心。下面给你几个靠谱的解决方案,都是无交互、安全不瞎改注册表的:

方案1:优化卸载命令的参数(最推荐,无需额外工具)

Adobe的卸载程序对无交互参数的要求比较特殊,不是所有情况都用/quiet。我们可以针对MSI安装包和Adobe原生卸载程序分别调整参数,同时避免cmd解析路径时的坑:

# 获取所有卸载注册表项
$AllRegAppEntries = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall,HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | ForEach-Object { Get-ItemProperty -Path $_.PSPath }

# 过滤出Adobe Acrobat Reader,排除系统组件避免误删
$FilteredApps = $AllRegAppEntries | Where-Object { 
    $_.DisplayName -ilike "*Adobe Acrobat Reader*" -and 
    $_.SystemComponent -ne $true 
}

foreach ($App in $FilteredApps) {
    if ($App.UninstallString) {
        $uninstallCommand = $App.UninstallString
        # 根据卸载程序类型适配无交互参数
        if ($uninstallCommand -match 'msiexec') {
            # MSI格式安装包,使用/qn(完全无交互)替换现有交互参数
            $uninstallCommand = $uninstallCommand -replace '/prompt|/passive|/interactive', '/qn'
            # 如果原命令没有参数,手动添加/qn
            if (-not $uninstallCommand.Contains('/qn')) {
                $uninstallCommand += ' /qn'
            }
        } else {
            # Adobe原生卸载程序,使用/s(静默无交互)替换现有参数
            $uninstallCommand = $uninstallCommand -replace '/prompt|/passive', '/s'
            if (-not $uninstallCommand.Contains('/s')) {
                $uninstallCommand += ' /s'
            }
        }

        Write-Host "执行卸载命令: $uninstallCommand"
        # 直接调用exe而非通过cmd,避免路径带空格的解析问题
        if ($uninstallCommand -match '^"[^"]+"') {
            $exePath = $matches[0].Trim('"')
            $arguments = $uninstallCommand.Substring($matches[0].Length).Trim()
            Start-Process -FilePath $exePath -ArgumentList $arguments -Wait -NoNewWindow
        } else {
            Start-Process -FilePath cmd.exe -ArgumentList "/c $uninstallCommand" -Wait -NoNewWindow
        }
    }
}

这个脚本的改进点:

  • 排除了SystemComponenttrue的注册表项,防止误删系统关联组件
  • 自动识别卸载程序类型,用Adobe官方认可的无交互参数(MSI用/qn,原生卸载用/s
  • 直接调用卸载程序而非通过cmd中转,解决了路径带空格时的解析错误,同时-NoNewWindow确保不会弹出额外窗口

方案2:使用Adobe官方卸载工具(最彻底)

如果上面的脚本还是有问题,Adobe提供了专门的Acrobat清理工具,能彻底卸载所有相关组件,而且完全无交互。你可以把这个工具和脚本一起打包成.intunewin文件,避免在线下载的不稳定:

# 假设工具已经和脚本一起打包,路径为当前目录下的AcroCleaner.exe
$cleanerPath = Join-Path -Path $PSScriptRoot -ChildPath "AcroCleaner.exe"

# 静默运行清理工具,完全无交互
Start-Process -FilePath $cleanerPath -ArgumentList "/silent" -Wait -NoNewWindow

注意事项:

  • 你可以从Adobe官方渠道获取最新的Acrobat Cleaner Tool,打包到你的IntuneWin包中
  • 这个工具会卸载所有Acrobat相关版本(包括32位),适合彻底清理后部署64位版本

方案3:提前停止Acrobat相关服务(辅助优化)

有时候Acrobat的后台服务在运行,会导致卸载时弹出窗口。可以在卸载前先停止这些服务:

# 停止Adobe相关的后台服务
Get-Service -Name "AdobeARMservice" -ErrorAction SilentlyContinue | Stop-Service -Force
Get-Service -Name "AdobeUpdateService" -ErrorAction SilentlyContinue | Stop-Service -Force

# 接着执行上面的卸载脚本...

备注:内容来源于stack exchange,提问作者Mart__

火山引擎 最新活动