Need help. Uninstall dialog box does not run and uninstall does not work.

Topics: Archive - Deployment Scripts
Aug 4, 2014 at 7:25 PM
This script performs the installation or uninstallation of an application(s).  
The script is provided as a template to perform an install or uninstall of an application(s). 
The script either performs an "Install" deployment type or an "Uninstall and ROLLBACK" deployment type.
The install deployment type is broken down in to 3 main sections/phases: Pre-Install, Install, and Post-Install.
The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
To access the help section,
Deploy-Application.ps1 -DeploymentType "Silent"
Deploy-Application.ps1 -AllowSCCMReboot -AllowDefer
Deploy-Application.ps1 -Uninstall 
.PARAMETER DeploymentType
The type of deployment to perform. [Default is "Install"]
Specifies whether the installation should be run in Interactive, Silent or NonInteractive mode.
Interactive = Default mode
Silent = No dialogs
NonInteractive = Very silent, i.e. no blocking apps. Noninteractive mode is automatically set if an SCCM task sequence or session 0 is detected.
.PARAMETER AllowRebootPassThru
Allows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation. 
If 3010 is passed back to SCCM a reboot prompt will be triggered.
Param (
[string]$DeploymentType = "Install",     
[string]$DeployMode = "Interactive",
[switch]$AllowRebootPassThru = $false
Function Trigger-Inventory {
$SCCMClient = [wmiclass]''
$SCCMClient.psbase.options.timeout = 20000000 #time in ticks - 2 seconds
$SCCMClient.psbase.path = "\\.\root\ccm:sms_client"



Try {



Variables: Application

$appVendor = "Corel"
$appName = "WinZip"
$appVersion = "18.0.11023"
$appArch = ""
$appLang = "EN"
$appRevision = "01"
$appScriptVersion = "1.0.0"
$appScriptDate = "08/04/2013"
$appScriptAuthor = "Carlos Castillo"


Variables: Script - Do not modify this section

$deployAppScriptFriendlyName = "Deploy Application"
$deployAppScriptVersion = "3.0.0"
$deployAppScriptDate = "01/04/2014"
$deployAppScriptParameters = $psBoundParameters

Variables: Environment

$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Definition

Dot source the App Deploy Toolkit Functions

$InstallVersion = "18.0.11023"
$NewKey = "CE14062-WinZip18.0"
$OldKey = "CE14062-WinZip16.5"






If ($deploymentType -ne "uninstall") { $installPhase = "Pre-Installation"


# Show Welcome Message, close Internet Explorer if required, allow up to 3 deferrals, verify there is enough disk space to complete the install and persist the prompt
Show-InstallationWelcome -CloseApps "iexplore.exe,winword.exe,excel.exe,outlook.exe,powerpnt.exe,onenote.exe,mspub.exe,msaccess.exe,AcroRd32" -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt

# Show Progress Message (with the default message)
# Get Installed Application GUID and verify if Application is installed
if ((Get-InstalledApplication -ProductCode "{CD95F661-A5C4-44F5-A6AA-ECDD91C240E1}"| where-object{$_.Displayversion -eq $InstallVersion}) -eq $Null){
    if (Get-InstalledApplication "WinZip"){
        # Remove any previous versions of WinZip
        Remove-MSIApplications "WinZip"
        # Remove registry key of older application version
        remove-item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$OldKey"
        Write-Log "Removed Key - HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$Oldkey"

    $installPhase = "Installation"

    # Install the base MSI and apply a transform
    Execute-MSI -Action Install -Path "$scriptDirectory\Install\86\winzip180-32.msi" -Transform "transform.mst"

    $installPhase = "Post-Installation"

    # ADD Application Registry Key
    new-item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$NewKey"
    #Check if key exists:
    If (test-path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$NewKey") {
        Write-Log "Created Key - HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$NewKey"
        set-itemproperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$NewKey" -name DisplayName -type String -Value "NewKey"

    # Copy WZMUL file to C:\ProgramData\WinZip
    Copy-File -Path "$scriptDirectory\SpecialTools\lic18\WinZip.wzmul" -Destination "C:\ProgramData\WinZip"

    # Refresh SCCM Client Policy




} Elseif ($deploymentType -eq "uninstall") { $installPhase = "uninstall"
Write-log "Beginning Uninstall"
# Prompt the user to close the following applications if they are running:
Show-InstallationWelcome -CloseApps "iexplore.exe,winword.exe,excel.exe,outlook.exe,powerpnt.exe,onenote.exe,mspub.exe,msaccess.exe,AcroRd32" -AllowDefer -DeferTimes 3
# Show Progress Message (with a message to indicate the application is being uninstalled)
Show-InstallationProgress -StatusMessage "Rolling Back to WinZip 16.5. Please Wait..." 
# Remove this version of WinZip
Execute-MSI -Action Uninstall -Path "{CD95F661-A5C4-44F5-A6AA-ECDD91C240E1}"
# Install Previous Version of WinZip
Execute-MSI -Action Install -Path "$scriptDirectory\Rollback\86\WINZIP16-32.MSI" -Transform "transform.mst"
# Remove registry key of newer application version
remove-item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$NewKey"
# Check if key exists:
If ((test-path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$NewKey") -eq $false) {
    Write-Log "Removed Key - HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$NewKey"
# Punch OldKey registry of the rolled back application version
new-item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$OldKey"
If ((test-path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$OldKey") -eq $true) {
    Write-Log "Created Key - HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$OldKey"
    set-itemproperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$OldKey" -name DisplayName -type String -Value "$OldKey"    
# Remove latest WZMUL file from C:\ProgramData\WinZip
Remove-File -Path "C:\ProgramData\WinZip\WinZip.wzmul"

# Copy WinZip 16.5 WZMUL file to C:\ProgramData\WinZip
Copy-File -Path "$scriptDirectory\SpecialTools\lic165\WinZip.wzmul" -Destination "C:\ProgramData\WinZip"

}} Catch {$exceptionMessage = "$($_.Exception.Message) ($($_.ScriptStackTrace))"; Write-Log "$exceptionMessage"; Show-DialogBox -Text $exceptionMessage -Icon "Stop"; Exit-Script -ExitCode 1} # Catch any errors in this script
Exit-Script -ExitCode 0 # Otherwise call the Exit-Script function to perform final cleanup operations


Aug 4, 2014 at 9:25 PM
Got it figured out. Please disregard.