I wrote and used this often (before using a 3PP solution). The only thing is I couldn't find a static link to Adobe Reader DC when I wrote this, so I simply downloaded the latest version, and hosted it in AWS S3 and pulled it from there. So feel free to find a static URL or do the same I did.
Function New-FileDownload {
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$Url,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$Destination
)
$webClient = New-Object System.Net.WebClient
$webClient.DownloadFile($Url, $Destination)
if (Test-Path -LiteralPath $Destination) {
Write-Verbose "File downloaded Successfully"
return $true
}
else {
Write-Verbose "File download Failed"
return $false
}
}
$AppName = "Adobe Acrobat Reader DC"
$InstallStatus = Get-ItemProperty "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" |
Where-Object { $_.DisplayName -eq $AppName }
if ($InstallStatus) {
Write-Output "$($AppName) already installed."
Exit 0
}
$AdobeURL = "ENTER YOUR URL TO AdobeReaderDC.exe"
$Destination = "$($env:temp)\adobeinstall.exe"
$FileDownload = New-FileDownload -Url $AdobeURL -Destination $Destination
if ($FileDownload) {
Write-Output "Download succeeded, beginning Adobe Reader install..."
Start-Process "$($Destination)" -ArgumentList "/sAll /rs /msi EULA_ACCEPT=YES" -Wait -NoNewWindow
$InstallStatus = Get-ItemProperty "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" |
Where-Object { $_.DisplayName -eq $AppName }
if ($InstallStatus) {
Write-Output "$($AppName) successfully installed."
Exit 0
}
else {
Write-Output "$($AppName) failed to install."
Exit 1
}
}
else {
Write-Output "Failed to download installation file. Exiting."
Exit 1
}