Uninstall the previous version of the application being installed

//Uninstall the previous version of the application being installed
Uninstall the previous version of the application being installed 2018-02-14T13:19:02+00:00

The Toolkit Forums General Uninstall the previous version of the application being installed

  • Author
    Posts
  • JT-65
    Participant
    Post count: 13

    I have an application that insists that the previous version be removed before the new one can be installed. My cunning plan was to provide the GUIDs for the new version and the previous version and attempt to uninstall each of them, like so:

    $GUIDs = @(“{25D5233F-C473-5C50-8253-53FB6DFF2581}”,”{C66139FA-C7F6-4980-A696-DC64ABC6BC3F}”)
    ForEach ($GUID in $GUIDs)
    {
    Execute-MSI -Action ‘Uninstall’ -Path $GUID -SkipMSIAlreadyInstalledCheck
    }

    It fails to uninstall the previous version with The MSI is not installed on this system. Skipping action [Uninstall].

    Am I doing something wrong? Should I just switch to Execute-Process and call msiexec.exe? Any other suggestions?

  • Jim
    Participant
    Post count: 54

    Why are you passing the GUID of both the old and new MSI to the foreach loop? Why not just use the display name to remove the old? And just use the path to the new MSI file?

    Remove-MSIApplications -Name 'OldApplicationNameHere'

    Execute-MSI -Action Install -Path 'NewMSINameHere.msi'

    • JT-65
      Participant
      Post count: 13

      I’ll tell you why am I passing the GUID. Since the Execute-MSI has an Action parameter, the thought of looking for another command that actually does what I want, never occurred to me. TL;DR I’m a fool!

      Jim, I want to thank you for your answer. This week has been fraught with answers (in other forums) that, while technically answers, were not answers to the questions I asked. You, on the other hand, gave me exactly what I needed. If I could up-vote you, I would.

      Thanks again.

  • Jim
    Participant
    Post count: 54

    Get rid of the -SkipMSIAlreadyInstalledCheck parameter…

  • Jim
    Participant
    Post count: 54

    JT, glad I was able to help. Thanks for the compliment.

    Jim

You must be logged in to reply to this topic.