Need to uninstall old version before installing new version

Below is what I am working with. Unfortunately both of these Argus versions share the same MSI code.

Is someone able to provide an example like an IF Statement to check if the Old Argus version is installed, and if it is, uninstall it?

  1. Old Argus version
    Name: ARGUS Enterprise 13.0
    Publisher: ARGUS Software
    Size: 1.26 GB
    Version: 13.0.3.490
    MSI Code: {2D9E5AF3-0BE8-4A3B-A01B-95725DF417D7}

  2. New Argus version
    Name: ARGUS Enterprise 13.0
    Publisher: ARGUS Software
    Size: 968 MB
    Version: 13.0.3.1830
    MSI Code: {2D9E5AF3-0BE8-4A3B-A01B-95725DF417D7}

Hi,
There are multiple ways of doing it such as

$isitinstalled = Get-InstalledApplication -Name “ARGUS Enterprise 13.0” -Exact
switch($isitinstalled.DisplayVersion) {
{$_ -eq ‘13.0.3.490’ }
{
Write-Log -Message “Found Argus 13.0.3.490, uninstalling it.”
$guid = $isitinstalled.UninstallSubkey
Write-Log -Message “Uninstall GUID is $guid”
Execute-MSI -Action Uninstall -Path $guid
}
}

  • Remove-MSIApplications -Name ‘ARGUS Enterprise 13.0’ -FilterApplication @(‘DisplayVersion’ ,‘13.0.3.490’ ,‘Exact’)

either of these will work.

2 Likes

Thank you so much! I am going to add this to my notes for future reference as well.

1 Like

Hi the code that @KushPat posted will definitely get your problems solved, there is also the issue of detecting if the correct (new) version of the app has landed on a machine if you are using a deployment tool (such as SCCM / MECM / ConfigMgr or Intune).
In Intune it can be handled via a detection rule like this (thanks to the 'MSI product version check switch):
image

I hope this helps?

1 Like

If you just want to get sure that any old Version is uninstalled before installing the new one you can simple Use

Remove-MSIApplications -Name “ARGUS Enterprise”

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.