Show-InstallationPrompt Fails to display on specific conditions PSADTv3.5 & v3.6

Topics: Archive - Deployment Scripts, Archive - Toolkit Extensions
Mar 21, 2015 at 1:49 AM
Edited Mar 24, 2015 at 12:19 AM
I have two Deploy-Application.ps1 scripts that leverage the same Logic as well as the same AppDeployToolkitExtensions.ps1, one executes flawlessly in that the Show-InstallationPrompt displays as desired and as expected while the other script exhibits in my opinion flawed behavior. The scripts are essentially Identical in terms of how the detection logic is processed save the product DisplayName and Version. Determining the root cause has been elusive for the lack of a better word. Once again I'm missing something.

The Show-InstallationPrompt Fails to display a MsgBox indicating that the App was successfully uninstalled, yet the log entries below seem to suggest that the Show-InstallationPrompt was processed successfuly.
[03-20-2015 18:58:18.015] [Uninstallation] [Show-InstallationPrompt] :: Displaying custom installation prompt with the non-default parameters: [-NoWait:$true -Icon "Information" -ButtonMiddleText "OK" -Message "The uninstallation of Wireshark 1.12.4 complete."]...
[03-20-2015 18:58:18.166] [Post-Uninstallation] [Exit-Script] :: @{InstallSource=; UninstallString="C:\Program Files\Wireshark\uninstall.exe"; Is64BitApplication=False; ProductCode=Wireshark; InstallLocation=C:\Program Files\Wireshark; Publisher=The Wireshark developer community, http://www.wireshark.org; InstallDate=; DisplayVersion=1.12.4; DisplayName=Wireshark 1.12.4 (64-bit)} Uninstallation completed with exit code [0].
[03-20-2015 18:58:18.214] [Post-Uninstallation] [Show-BalloonTip] :: Display balloon tip notification asyhchronously with message [Uninstallation complete.]
Development-Deploy-Application.ps1
Show-InstallationPrompt -Message "The uninstallation of $DisplayName $DisplayVersion complete." -ButtonMiddleText 'OK' -Icon Information -NoWait    
Moreover, Show-InstallationPrompt Fails to display a MsgBox indicating that the App was detected prior to making an installation attempt based on a custom parameter that calls a function to process detection logic to call Show-InstallationPrompt if the condition is met. This failure is as consistent as the one listed above.
AppDeployToolkitExtensions.ps1
Function IsInstallStatus {
    if ($InstallName -and $InstallVersion) {
        Show-InstallationPrompt -Message "$DisplayName $DisplayVersion is installed." -ButtonMiddleText 'OK' -Icon Information -NoWait; Write-Log "ErrorCode Return value is: 1638, proceeding."; Exit-Script -ExitCode 1638
    } else {
        Write-Log -Message "$DisplayName $DisplayVersion not installed, proceeding."
    }
}
Conversely, the Show-InstallationPrompt consistently passes when displaying a MsgBox indicating that the App was successfully installed as suggested by the log entries below.
[03-20-2015 19:04:29.759] [Post-Installation] [Show-InstallationPrompt] :: Displaying custom installation prompt with the non-default parameters: [-NoWait:$true -Icon "Information" -ButtonMiddleText "OK" -Message "The installation of Wireshark 1.12.4 complete."]...
[03-20-2015 19:04:29.900] [Post-Installation] [Exit-Script] :: Installation completed with exit code [0].
[03-20-2015 19:04:29.933] [Post-Installation] [Show-BalloonTip] :: Display balloon tip notification asyhchronously with message [Installation complete.]
Development-Deploy-Application.ps1
Show-InstallationPrompt -Message "The installation of $DisplayName $DisplayVersion complete." -ButtonMiddleText 'OK' -Icon Information -NoWait
Furthermore, Show-InstallationPrompt consistently passes when displaying a MsgBox indicating that the App was detected prior to making an uninstallation attempt based on a custom parameter that calls a function to process detection logic to call Show-InstallationPrompt if the condition is met as suggested by the log entries below.
[03-20-2015 19:01:41.873] [Pre-Uninstallation] [Show-InstallationPrompt] :: Displaying custom installation prompt with the non-default parameters: [-NoWait:$true -Icon "Information" -ButtonMiddleText "OK" -Message "Wireshark 1.12.4 not installed."]...
03-20-2015 19:01:41.930] [Pre-Uninstallation] :: ErrorCode Return value is: 1605, proceeding.
[03-20-2015 19:01:41.994] [Pre-Uninstallation] [Exit-Script] :: Uninstallation completed with exit code [1605].
[03-20-2015 19:01:42.027] [Pre-Uninstallation] [Show-BalloonTip] :: Display balloon tip notification asyhchronously with message [Uninstallation failed.]
AppDeployToolkitExtensions.ps1
Function IsUninstallStatus {
    if ($InstallName -and $InstallVersion) {
        Write-Log -Message "$DisplayName $DisplayVersion is installed, proceeding."
    } else {
        Show-InstallationPrompt -Message "$DisplayName $DisplayVersion not installed." -ButtonMiddleText 'OK' -Icon Information -NoWait; Write-Log "ErrorCode Return value is: 1605, proceeding."; Exit-Script -ExitCode 1605
    }
    
} 
I would have loved to include both the AppDeployToolkitExtensions.ps1 and the Development-Deploy-Application.ps1 files, but there doesn't appear a to be a method by which to upload the files for review. . I am grateful for all of the expert assistance that I've received with other problems thus far. Thanks in advance for your expert advice.

P.S. I've also noticed a weird anomaly when embedding "Show-InstallationPrompt" in a function in the "AppDeployToolkitExtensions.ps1" where I expect to see $appName = 'Wireshark' and $appVersion = '1.12.4' displayed in the title bar, but instead I see the following (truncated) text
@{InstallSource=; UninstallString=C:\Program Files\VideoLAN\VLC\uninstall.exe; Is64BitApplication=True; ProductCode=VLC media player; InstallLocation=C:\Program Files\VideoLAN\VLC; Publisher=VideoLAN; InstallDate=; DisplayVersion=2.2.0; DisplayName=VLC media player} Installation completed with exit code [1638].
See the screen shot below..

Screenshot

Best Regards,

Yves
Mar 25, 2015 at 2:57 AM
Edited Mar 25, 2015 at 2:58 AM
Apparently there was is a variable $InstallName in the AppDeployToolkitMain.ps1 that I was unaware existed and I learned the hard way the effects of inadvertently recycling/ re-purposing variables that have already been declared. I renamed the variable $InstallName in my Deploy-Application.ps1 to $InstallDisplayName and problem solved.
Marked as answer by yralexandre on 3/24/2015 at 7:57 PM