ZAP MSI Applications

Topics: Archive - Toolkit Extensions
Aug 8, 2014 at 1:39 PM
Edited Aug 8, 2014 at 5:54 PM
I find that we still use msizap for some older applications. because they don't uninstall right...even java sometimes. I understand that msizap.exe is not supported, but it works!. I've add this to the extensions:
# Your custom functions go here
Function Zap-MSIApplication {
    Removes all associated components for MSI applications matching the specified application name
    Zap all MSI applications matching the specified application name using MSiZap
    Enumerates the registry for installed applications matching the specified application name and uninstalls that application using the product code, provided the uninstall string matches "msiexec"
    Zap-MSIApplications "Adobe Flash"
    Zaps all versions of software that match the name "Adobe Flash"
    Zap-MSIApplications "Adobe"
    Zaps all versions of software that match the name "Adobe"
    The name of the application you want to zap.
.PARAMETER ContinueOnError
    Continue if an exit code is returned by msiexec that is not recognised by the App Deploy Toolkit.
        [Parameter(Mandatory = $true)]
        [string] $Name,
        [string] $ProductCode,
        [boolean] $ContinueOnError = $true

    $installedApplications = Get-InstalledApplication $name
    If ($installedApplications -ne "") {
        Foreach ($installedApplication in $installedApplications) {
            If ($installedApplication.UninstallString -match "msiexec") {
                Write-Log "Zapping Application " [$($installedApplication.DisplayName) $($installedApplication.Version)] "..."
                If ($ContinueOnError -eq $true) {
                   Execute-Process -FilePath "$envWinDir\system32\cmd.exe" -Arguments "/c ""$dirSupportFiles\MsiZap.exe"" GWT! $($installedApplication.ProductCode)" -WindowStyle Hidden -ContinueOnError $true
                Else {
                    Execute-Process -FilePath "$envWinDir\system32\cmd.exe" -Arguments "/c ""$dirSupportFiles\MsiZap.exe"" GWT! $($installedApplication.ProductCode)" -WindowStyle Hidden
            Else {
                Write-Log "$($installedApplication.DisplayName) uninstall string [$($installedApplication.UninstallString)] does not match `"msiexec`", so removal will not proceed."
Call it like you call Remove-MSIApplications
Zap-MSIApplications "Java(TM) 6 "
Be sure to download and copy the MsiZap.exe to supportfiles location
Aug 12, 2014 at 4:21 PM
Good stuff! I often find myself zapping older stuff. I'm definitely gonna work this in to mine.
Aug 23, 2014 at 10:13 AM
Be careful, msizap is no longer compatible with Windows 7...
I experienced a lot of problem with this tools and it delete all rights on certain registry keys....

Look at the post from Jeff Ingalls in the comments of this article....
Aug 26, 2014 at 8:18 PM
Yes msizap is "unsupported" if using the version lower than 3.1.4000.2726, also if you call it like this "MsiZap.exe GWT! {GUID}".. its not running the "a" option which would not change ACLs. That's why there is no option in the extension to allow parameter change. I've been running this for a long time on windows XP, 7, 8 and 8.1 and on 32-bit and 64-bit and have had no issues so far.

Use it at your own risk