Uninstall an Architecture-Specific MSI

From psadt | Evergreen Application Management
Jump to navigation Jump to search

About

Powershell.png

PSADT function to determine architecture of MSI (64/32-bit) and removes only the specified version.

Note:

  • $appName is the name of your given application.
  • This function is not a standalone PowerShell function but relies on the built-in functions of the PowerShell AppDeploy Toolkit. For this reason it only works within the PSADT.


Function

#region Function Uninstall-ArchSpecificMSI
Function Uninstall-ArchSpecificMSI {
<#
.SYNOPSIS
	Reads '''Deploy-Application.ps1''' determine architecture of MSI (64/32-bit) and removes only the specified version.
.DESCRIPTION
	Created to handle Java removals where both 32 and 64-bit versions are installed, and you only want to remove one of them.
.PARAMETER
.LINK
	http://psadt.com/
#>

Begin	{
	If ($appArch -eq "x64")
		{
		Remove-MSIApplications -Name $appName -ExcludeFromUninstall (,('Is64BitApplication', $false, 'Exact'))
		}
		
	Else
		{
		Remove-MSIApplications -Name $appName -ExcludeFromUninstall (,('Is64BitApplication', $true, 'Exact'))
		}
	}
}

#endregion