Show-InstallationPrompt Help

Topics: Archive - Deployment Scripts, Archive - General
Aug 11, 2014 at 7:37 PM
First off thanks for SUCH a GREAT TOOL!!!!!

I am working on a script to install some language packs for notes. I am looking to use the Show-InstallationPrompt item to allow the user to continue or cancel as desired. The issue is that I do not know how to translate the left or right button to either a continue or exit option. The documentation mentions the function but not how to use the buttons 'post user click'.

here is the code:
Show-InstallationPrompt -message "$MsgText" -ButtonLeftText "Cancel" -ButtonRightText "OK" -Icon "Information" -MinimizeWindows $True -ExitOnTimeout 900

I want to do the following:
If($buttonLeft){exit-script -exitcode 901}

It does not work.

Thanks in advance for your help.
Coordinator
Aug 11, 2014 at 7:52 PM
Hi,

It's very easy, the function returns the text of the button the user selected so you just assign a variable to it like this:

$userResponse = Show-InstallationPrompt -message "$MsgText" -ButtonLeftText "Cancel" -ButtonRightText "OK" -Icon "Information" -MinimizeWindows $True -ExitOnTimeout 900

If($userResponse -eq "Cancel") {exit-script -exitcode 901}

Sean
Aug 11, 2014 at 8:12 PM
Well that surely did the trick. I can tell its Monday. However that would be a good blurb to have in the help in various locations.

Again thanks for the super fast reply, it works perfectly now.

I had been using it in another script but it was only the notification version using an OK only box.
Aug 25, 2014 at 5:09 PM
So I thought about this if you exit with a generic error code...901 is a good exit code number but it still says installation failed. If we have users that "whine" about that or for me which I'm OCD about the look and feel, I would want it to say something different to the user, so I added a few more items to the AppDeployToolkitMain.ps1 and AppDeployToolkitConfig.xml.


AppDeployToolkitConfig.xml (at line 70), added below BalloonText_Error (I only did English), add:
<BalloonText_Stopped>was stopped.</BalloonText_Stopped><!-- Text displayed in the balloon tip for a stopped deployment type. -->
AppDeployToolkitMain.ps1 (at line 168) below [string]$configBalloonTextError add:
[string]$configBalloonTextStopped = $xmlUIMessages.BalloonText_Stopped
AppDeployToolkitMain.ps1 (at line 410) Insert before the" Else {", add:
ElseIf ($exitcode = "901"){
      $balloonText = "$deploymentTypeName $configBalloonTextStopped"
      Show-BalloonTip -BalloonTipIcon "Warning" -BalloonTipText "$balloonText"
}
Now when a user says no , it will error with 901 and display a warning (instead of error) and stated software was stopped

its "cleaner" to me...