Skip to main content

I do have the exe installer from adobe and have tried to create a worklet but it doesn’t appear to be working

I tried looking through the catalog and previous threads and couldn’t find anything. Is there already a worklet that exists to install adobe acrobat pro? 

 

I am posting the worklet I tried to create in hopes that someone could try to fix it. I use a payload with the setup.exe file. However this doesn’t appear to be working.

 

Any help is much appreciated!

 

<#
.SYNOPSIS
    EXE Software Installation (System Wide-All Users) - Evaluation Script
    OS Support: Windows 7 and above
    Required modules: NONE
.DESCRIPTION
    This worklet is designed to grant an Admin the ability to install a (System Wide-All Users) EXE with minimal knowledge of the bitness,
    command line, or other EXE properties. By placing an application name between the single quotes, the worklet will
    scan the registry for the matching application. If the application is not found, it will return an Exit code of '1'
    and flag the device for remediation.

    $displayName:
    The application name provided should match closely as it is displayed in "Programs and Features" (Add or Remove Programs)
    for Win7/8.1, and "Apps and Features" for Win10. Universal Windows Platform (UWP) applications are not currently
    supported in this worklet. Note: While this should work for most applications certain displaynames may require the use of wild cards (*).

    $displayVerison:
    This is the version of the application you are detecting. This version information should match what's is displayed in "Programs and Features" (Add or Remove Programs)
    for Win7/8.1, and "Apps and Features" for Win10. Sometimes developers use different versions than what's displayed. Please verify the associated displayversion in the registry to confirm.
.EXAMPLE
    $displayName = 'Power BI Desktop'
    $displayVersion = '2.108.997.0'
.NOTES
    Author: Sonny Plotner, Eric Liles
    Date: September 1, 2022
#>

######## Make changes within the block ########
# Add Application name exactly as it appears in Add/Remove Programs, Programs and Features, or Apps and Features between single quotes.
$displayName = 'Adobe Acrobat'
$displayVersion = '23.008.20421'
#########################################

################ MAIN CODE ##############
$unPath = "Software\Microsoft\Windows\CurrentVersion\Uninstall"
$confirm = $NULL

# Capture 32bit/64bit registry info
if(pSystem.Environment]::Is64BitOperatingSystem)
{
    $hklm64 = BMicrosoft.Win32.RegistryKey]::OpenBaseKey(6Microsoft.Win32.RegistryHive]::LocalMachine,eMicrosoft.Win32.RegistryView]::Registry64)
    $skey64 = $hklm64.OpenSubKey("$unPath")
}

$hklm32 = lMicrosoft.Win32.RegistryKey]::OpenBaseKey(lMicrosoft.Win32.RegistryHive]::LocalMachine,eMicrosoft.Win32.RegistryView]::Registry32)
$skey32 = $hklm32.OpenSubKey("$unPath")

if(>System.Environment]::Is64BitOperatingSystem)
{
    foreach ($key in $skey64.GetSubKeyNames())
    {
        if($hklm64.OpenSubKey("$unPath\$key").GetValue("DisplayName") -like "$displayName*")
        {
            if($hklm64.OpenSubKey("$unPath\$key").GetValue("DisplayVersion") -ge fVersion]"$displayVersion")
            {
                $confirm += 1
            }
        }
    }
}

foreach ($key in $skey32.GetSubKeyNames())
{
    if($hklm32.OpenSubKey("$unPath\$key").GetValue("DisplayName") -like "$displayName*")
    {
        if($hklm32.OpenSubKey("$unPath\$key").GetValue("DisplayVersion") -ge "Version]"$displayVersion")
        {
            $confirm += 1
        }
    }
}

if(pSystem.Environment]::Is64BitOperatingSystem)
{
    $hklm64.close()
}
$hklm32.close()

if($confirm)
{
    Write-Output "Installed"
    Exit 0
}
else
{
    Write-Output "Not Installed"
    Exit 1
}

 

<#
.SYNOPSIS
    EXE Software Installation (System Wide-All Users) - Remediation Script
    OS Support: Windows 7 and above
    Required modules: NONE
.DESCRIPTION
    This worklet is designed to grant an Admin the ability to install a (System Wide-All Users) EXE with minimal knowledge of the bitness,
    command line, or other EXE properties. By placing the name of the EXE to be uploaded, between the single quotes,
    the worklet will apply the standard command line arguments to silently install the application with logging.
    Once installation has been completed, the script will then check both 32bit and 64bit registry hives to verify
    installation was successful.

    $displayName:
    The application name provided should match closely as it is displayed in "Programs and Features" (Add or Remove Programs)
    for Win7/8.1, and "Apps and Features" for Win10. Universal Windows Platform (UWP) applications are not currently
    supported in this worklet. Note: While this should work for most applications certain displaynames may require the use of wild cards (*).

    $displayVerison:
    This is the version of the application you are detecting. This version information should match what's is displayed in "Programs and Features" (Add or Remove Programs)
    for Win7/8.1, and "Apps and Features" for Win10. Sometimes developers use different versions than what's displayed. Please verify the associated displayversion in the registry to confirm.

    $fileName:
    This is the filename, including extension, of the file to be uploaded into the console. See examples for more information.

    $arguments:
    Switches you want to pass.
.EXAMPLE
    $displayName = 'Everything'
    $displayVersion = '1.4.1.986'
    $fileName = 'Everything-1.4.1.986.x64-Setup.exe'
    $arguments = '/S'
.NOTES
    Author: Sonny Plotner, Eric Liles
    Date: September 1, 2022
#>

######## EDIT WITHIN THIS BLOCK #######
$displayName = 'Adobe Acrobat'
$displayVersion = '23.008.20421'
$fileName = 'setup.exe'
$arguments = '/S'
#######################################

############# MAIN CODE ###############
# EXE/Script location. Joined with filename to pass a single variable to function.
$sPath = Split-Path $Script:MyInvocation.MyCommand.Path -Parent
$fPath = "$sPath\$fileName"

# Kicking off installer
start-process "$fPath" -ArgumentList "$arguments" -wait

#### Installation validation ####
$unPath = "Software\Microsoft\Windows\CurrentVersion\Uninstall"
$confirm = $NULL

# Capture 32bit/64bit registry info
if(>System.Environment]::Is64BitOperatingSystem)
{
    $hklm64 = \Microsoft.Win32.RegistryKey]::OpenBaseKey(nMicrosoft.Win32.RegistryHive]::LocalMachine,iMicrosoft.Win32.RegistryView]::Registry64)
    $skey64 = $hklm64.OpenSubKey("$unPath")
}

$hklm32 = rMicrosoft.Win32.RegistryKey]::OpenBaseKey(rMicrosoft.Win32.RegistryHive]::LocalMachine,rMicrosoft.Win32.RegistryView]::Registry32)
$skey32 = $hklm32.OpenSubKey("$unPath")

if(cSystem.Environment]::Is64BitOperatingSystem)
{
    foreach ($key in $skey64.GetSubKeyNames())
    {
        if($hklm64.OpenSubKey("$unPath\$key").GetValue("DisplayName") -like "$displayName*")
        {
            if(rVersion]$hklm64.OpenSubKey("$unPath\$key").GetValue("DisplayVersion") -ge hVersion]"$displayVersion")
            {
                $confirm += 1
            }
        }
    }
}

foreach ($key in $skey32.GetSubKeyNames())
{
    if($hklm32.OpenSubKey("$unPath\$key").GetValue("DisplayName") -like "$displayName*")
    {
        if(ÂVersion]$hklm32.OpenSubKey("$unPath\$key").GetValue("DisplayVersion") -ge kVersion]"$displayVersion")
        {
            $confirm += 1
        }
    }
}

if(lSystem.Environment]::Is64BitOperatingSystem)
{
    $hklm64.close()
    $hklm64 = $NULL
}
$hklm32.close()
$hklm32 = $NULL

if($confirm)
{
    Write-Output "Successfully installed $displayName version $displayVersion"
    Exit 0
}
else
{
    Write-Output "Failed to install $displayName version $displayVersion. Please see installation logs if applicable."
    Exit 1
}

Hey @justlooking 

Thinking a couple of areas to improve on.

  1. Make sure the $displayName and $displayVersion are an exact match for what you see in Add/Remove programs
  2. Command line switches may need updated based on https://www.adobe.com/devnet-docs/acrobatetk/tools/DesktopDeployment/cmdline.html

    Perhaps you could try these for the $arguments variable instead:

    /msi EULA_ACCEPT=YES /qn

    or

    /sAll /rs

My all time favorite way to test my code visually (because code runs in 32-bit version of PowerShell)

  1. Download Microsoft PSExec
  2. Now launch a 32-bit version of PowerShell
    psexec -s -i -d C:\windows\SysWOW64\WindowsPowerShell\v1.0\powershell_ise.exe
  3. Build and test your script with the ISE.

Backup way to see what code is doing drop these commands at the start/end of the script.

Start-Transcript C:\temp\worklet.txt
Stop-Transcript

 


Reply