0

Hi As of acrobat drops support on x versions id like to make a script for our monitoring system.

Currently i have:

$FullFolderPath = 'C:\Program Files (x86)\Adobe Reader DC';
$FolderName = (Split-Path $FullFolderPath -Leaf).ToString();
$DashIndex = $FolderName.IndexOf('Re');
$FolderNameFromDashToEnd = $FolderName.SubString($DashIndex);


$ADDC = "Reader DC"

if (($ADDC) -notcontains $FolderNameFromDashToEnd){
Write-Host "End of Support $adobeversion"
Exit 1010
}
else {
Write-Host "Adobe $FolderNameFromDashToEnd"
Exit 0
}

But i have both C:\Program Files (x86)\Adobe\Acrobat 2017 and C:\Program Files (x86)\Adobe\Acrobat Reader DC.

There are multiple version so i need to exclude all but reader dc folder. Does anyone know a good hack for this?

Expect: If folder acrobat* excist but its not acrobat reader dc, then:

I also tried several options with:

$acrobatversion = Get-Childitem "C:\Program Files (x86)\Adobe\Acrobat*" | Select-Object @{Name="Name"; Expression = {$_.Name}}
$acrobatversion

But it just enlist the two acrobat folders

IIIdefconIII
  • 353
  • 2
  • 5
  • 13
  • Possible duplicate of [How can I exclude multiple folders using Get-ChildItem -exclude?](https://stackoverflow.com/questions/15294836/how-can-i-exclude-multiple-folders-using-get-childitem-exclude) – Manu Oct 26 '17 at 19:26
  • Have you considered using the [System.IO] .Net class library with File or Directory? Most Windows installations contain the libraries as part of the native OS. –  Oct 27 '17 at 01:47

1 Answers1

1

You could check the Uninstall registry keys for information on the Reader installs. Then filter with Where-Object so that you only have Classic Track installs.

$ReaderClassicTrackInstalls = @((Get-ChildItem HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\), (Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\)) |
    ForEach-Object {
        Get-ItemProperty ($_ -replace 'HKEY_LOCAL_MACHINE', 'HKLM:') |
            Where-Object {$_.displayname -like "Adobe Acrobat Reader*" -and $_.displayname -notlike '*DC'}
    }
$ReaderClassicTrackInstalls |
    Select-Object InstallLocation, DisplayVersion
BenH
  • 9,766
  • 1
  • 22
  • 35
  • thanks for sharing this with me, so cool that you guys can do this, im feel stupid maybe it time to follow a training But the script didnt work no output while Acrobat Reader 2017 folder excist. Maybe its anothey key, will take a look tomorrow – IIIdefconIII Oct 26 '17 at 20:06
  • Reader2017 does not follow the Uninstall registry keys method. They have a lot of great documentation on their installers – Maximilian Burszley Oct 26 '17 at 21:39
  • @TheIncorrigible1 It's not a convention or a method. Both tracks of Reader installers are .msi based. The updates are .msp's. I just showed the output of a test install... It makes the reg key `HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-FFFF-7B44-AE1108756300}`... – BenH Oct 27 '17 at 14:01