Author Posts

May 18, 2018 at 5:04 pm

Howdy Guys!
I am stuck with the Acrobat Reader verification and Installation script
The code needs to
1. Ensure that Acrobat Reader has been installed. The minimum version is 9.5 If it is not installed, install it using the installer on E:\ Acrobat Reader W2008
2. Attach screenshots.

I used the code as below but it isnt working out

$tempdir = Get-Location
$tempdir = $tempdir.tostring()
$appToMatch = '*Acrobat Reader*'
#$msiFile = $tempdir+"ADR.exe"
#The below location should be the location of the Acrobat File
$msiFile = C:\Temp\ADR.exe

$msiArgs = "-qb"

function Get-InstalledApps
{
if ([IntPtr]::Size -eq 4) {
$regpath = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
}
else {
$regpath = @(
HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
)
}
Get-ItemProperty $regpath | .{process{if($_.DisplayName -and $_.UninstallString) { $_ } }} | Select DisplayName, Publisher, InstallDate, DisplayVersion, UninstallString |Sort DisplayName
}

$result = Get-InstalledApps | where {$_.DisplayName -like $appToMatch}

If ($result -eq $null) {
(Start-Process -FilePath $msiFile -ArgumentList $msiArgs -Wait -Passthru).ExitCode
}

Please assist.

May 18, 2018 at 7:02 pm

Not a direct answer.
But if you do this on a regular basis on many machines, then it's probably better to look into a tool for software deployment.
Rather than scripting it manually.

Either via more conventional stuff like Microsoft SCCM or you can use something like Chocolatey.
Chocolatey uses a more linux-like/repository approach and you can use it with different configuration tools like Puppet, Powershell DSC etc or stand-alone.