Skip to Main Content
Patch My PC Feature and Application Request

A community where customers and the community can provide feedback to make a better product for everyone! For more details on how we prioritize request, please see:

Status SUBMITTED
Created by Pepijn Vermeersch
Created on Oct 16, 2019
Merged idea

This idea has been merged into another idea. To comment or vote on this idea, please visit PATCHMYPC-I-734 Auto Uninstall Old Ghost Script.

Uninstall previous versions of some applications (like done for Java) Merged

Some applications don't uninstall previous versions when upgrading, so all old versions remain on the machine just like for Java client before the Patch My PC defined pre/post script exist

* GPL Ghostscript

* R for Windows

 

probably other applications have the same issue

  • Admin
    Justin Chalfant
    Reply
    |
    Oct 21, 2019

    Nice! You just added this as a pre-update script? Do you know why the vendor may not auto-remove the older version by default? I just don't want to break anything if the older versions are left there for a reason.

  • Pepijn Vermeersch
    Reply
    |
    Oct 21, 2019

    I used the Java script to make a quick and dirty version for GPL Ghostscript

     

    #Set variables#
    $AppToUninstall = "GPL Ghostscript*"
    $PublisherToUninstall = "Artifex Software Inc.*"

     

    process{
    set-TSxDefaultLogPath -defaultLogLocation:$false -LogLocation $ENV:TEMP
    $Software = Get-InstSoftware | Where-Object {($_.DisplayName -like $AppToUninstall) -and ($_.Publisher -like $PublisherToUninstall)}
    Write-TSxLog -Message "Starting log for $AppToUninstall removal for Patch My PC"
    If ($Software -eq $null) {
    Write-TSxLog -Message "Exit 0"
    Exit 0}
    Else{
    foreach($Install in $Software)
    {
    Write-TSxLog -Message "Now removing $($Install.DisplayName) using command $($Install.UninstallString)"
    try {
    $Results = Start-Process $Install.UninstallString -ArgumentList /S -Wait -NoNewWindow -ErrorAction Stop -PassThru
    Write-TSxLog -Message "The application was uninstalled with Exit Code: $($Results.ExitCode)"
    }
    catch {
    Write-TSxLog -Message "An error occured trying to remove a version of the software it terminated with the error $($_.Exception.Message)" -LogLevel 3
    Write-TSxLog -Message "The Exit code was $($Results.ExitCode)"
    }
    Write-TSxLog -Message "The application has been succesfully removed"
    }
    }
    }

     

     

  • Admin
    Justin Chalfant
    Reply
    |
    Oct 16, 2019

    We will look into this to see what we could do.

  • +2