Question

Uninstall Adobe Acrobat DC (2015) / Install Adobe Acrobat DC (Cloud)

  • 13 February 2024
  • 1 reply
  • 102 views

Badge

Is there already a worklet using the “AcroCleaner” tool to uninstall an older version Adobe Acrobat DC (2015), and then install the newest Adobe Acrobat DC (cloud/subscription) all in one worklet?  

 

I’m trying to cobble something together but struggling.  Any help would be appreciated.


1 reply

Userlevel 5
Badge +1

 I’ve not tested this. Just wrote it up real quick using some of my past code examples. Make sure to update the script accordingly as it likely won’t just “work”. 

Also know that I’m using Automox built in WDK which adds a cmdlet that I can use to search for installed programs and remove them: https://developer.automox.com/developer-portal/wdk/overview/

The install part is also likely from some Automox catalog item or something provided in the community at some point.

Good luck!

# Put application name exactly as it appears in Add Remove Programs
$AppName = 'Adobe Acrobat DC (2015)'

# Automox built in WDK https://community.automox.com/product-updates-4/the-automox-worklet-development-kit-is-live-now-2245
$app = Try { Get-Win32App | Where-Object { $_.Name -match "$AppName" } }catch{exit 0}
IF($app){
Write-Output "Removing $($app.name) installed $($app.InstallDate)"
IF($app.CanQuietUninstall){
Write-Output "Removing $($app.name) installed $($app.InstallDate)"
$app | Remove-Win32App
}else{
Write-Output "$($app.name) cannot be quietly uninstalled. "
IF($app.filepath -eq 'MsiExec.exe'){
Write-Output "$($app.name) used MsiExec, attempting to remove with: msiexec.exe $guid /qn "
$guid = ($app.ArgumentList).replace("/I","/X")
IF($guid -notmatch "/X"){$guid = "/X $guid"}
Start-Process MsiExec -ArgumentList "$guid /qn" -Wait
}
}
}

# Validate and if still installed, remove using AcroCleaner
### https://www.adobe.com/devnet-docs/acrobatetk/tools/Labs/cleaner.html
$app = Try { Get-Win32App | Where-Object { $_.Name -match "$AppName" } }catch{exit 0}
IF($app){
Write-Output "Failed to Remove $($app.name) installed $($app.InstallDate) attempting to remove with AcroCleaner"
Start-Process AcroCleaner.exe -ArgumentList "/silent /product=<ProductId> /installpath=<InstallPath> /cleanlevel=<CleanLevel> /scanforothers=<ScanForOthers>" -Wait
}

# Install Acrobat Reader DC
<#
.SYNOPSIS
This remediation script script will install Adobe Acrobat Reader DC
and immediatly update it to the newest version.

.DESCRIPTION
This script has the option for the user to specify the version which they want to install at "$latestVersion"
if the user not specified any version number to install,script downloads the installer into a powershell script
directry, executes it silently, and cleans up. it takes the latest version number by the directory listing,
for version of Reader with an .msi/.exe installer instead of .msp This is an example script that has been
tested to work on Win10 and Win7. This script may not work on all systems. Modify to fit your needs

.NOTES
File Name :Adobe_Reader_Install.ps1
Author :Automox
Prerequisite :PowerShell V2 over win7 and upper
#>

#Handle Exit Codes:
trap { $host.ui.WriteErrorLine($_.Exception); exit 90 }

# User can provide the version number which they want to install.
# if user not specified anything, script will check for the latest version from the ftp
# then install the latest version.

$latestVersion = ''

function Adobe_Reader_Install
{
#############User may update the settings in this block#######################
# Last Major Version:
# $mainURL="ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/"

#####################################################################

# Check user input for the version number
# This block checks the latest version number from the ftp folder list.
Try
{
if ($latestVersion -eq "")
{
$ftpFolderUrl = "ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/"
$ftpRequest = [System.Net.FtpWebRequest]::Create("$ftpFolderUrl")
$ftpRequest.Method = [System.Net.WebRequestMethods+Ftp]::ListDirectory
$ftpResponse = $ftpRequest.GetResponse()
$responseStream = $ftpResponse.GetResponseStream()
$ftpReader = New-Object System.IO.Streamreader -ArgumentList $responseStream
$dirList = $ftpReader.ReadToEnd()
$versionString = $dirList -split '[\r\n]' | Where { $_ } | Select -Last 1 -Skip 1
}
else
{
$versionString = $latestVersion.Replace(".", "")
}
}

Catch { Write-Output "Error in accessing the ftp folder" }

# Creating the ftp url for downloading the acreobat reader which we can get it from the wiki url
$installerurl = $ftpFolderUrl + $versionString + "/AcroRdrDC" + $versionString + "_en_US.exe"
# local path to save the exe file.
$output = "$PSScriptRoot\Acrobat_Reader_" + $versionString + ".exe"

# Creating WebClient Object.
$downloader = New-Object -TypeName System.Net.WebClient

# Download executable to the local drive.
Write-Output "Adobe Reader Installer is downloading..."
try
{
$downloader.DownloadFile($installerurl, $output);
Write-Output "Adobe Reader Installer download finished"
}
catch { Write-Output "File download failed. Check URL [$installerurl] and try again."; exit 90 }

#Start the installer, capture and return exit code
Write-Output "Installing Reader..."
try
{
$process = Start-Process -FilePath "$output" -ArgumentList "/qn EULA_ACCEPT=YES AgreeToLicense=Yes RebootYesNo=No /sAll" -Wait -PassThru -ErrorAction Stop;
Write-Output "Adobe Reader Install Finished."
}
Catch
{
$Exception = $error[0].Exception.Message + "`nAt Line " + $error[0].InvocationInfo.ScriptLineNumber; Write-Output $Exception; exit 90
}

# Remove the installer downloaded.
Try { Remove-Item -force "$output" }
Catch { Write-Output "Skype Installer Not Available...`n"}
exit $process.ExitCode
}
Adobe_Reader_Install

 

Reply