Lets say you want to install a bigger application, like the Microsoft Office suite. But because it is a big and heavy package, you want to give your users the ability to defer the installation. Maybe you are upgrading from an older Office version, and the user needs to use outlook for the day.

One of the ways we can do this, is by using defer with the PowerShell App Deployment Toolkit (PSADT)

How do you defer with PSADT?

To be able to defer an installation with PSADT, you need to use the Show-InstallationWelcome  function. But this does not defer installation by it self.

There are two parameters with can use with Show-InstallationWelcome  in order to defer install, those are:

-AllowDefer

This will give the user a popup with the choice to defer the install, every time the script is executed.

-AllowDeferCloseApps

This will give the user a popup with the choice to defer the install, but ONLY if the processes with the parameters -CloseApps  are running. If they are not, it will ignore the defer and continue

Decide for how long to defer

Now we know how to defer, we need to find our, for how long. There are three methods. By x number of times the script is executed, by x days from first run, or by setting a deadline using a date.

Those Parameters are as following

  • -DeferTimes
  • -DeferDays
  • -DeferDeadline

-DeferTimes  and -DeferDays  are with set with a INT value, eg 3. where the -DeferDate  is set by entering a date.

Show-InstallationWelcome examples

Lets say we want to allow the user to defer the installation for up to 3 times, then we would use this

Show-InstallationWelcome -AllowDefer -DeferTimes 3

And that would look like this

psadtallowdeferdefertimes3

 

In this example we want to defer 3 time again, but this time we do only want to do that, if Internet Explorer is running on the device.

Show-InstallationWelcome -AllowDeferCloseApps -DeferTimes 3 -CloseApps “iexplore”

And that would look like this

psadtallowdeferdefertimes3closeapps

 

In the last example we want to allow the user to defer the installation for up to 5 days.

Show-InstallationWelcome -AllowDefer -DeferDays 5

And that would look like this

psadtallowdeferdeferdays5

 

I hope this article helped you to understand the Show-InstallationWelcome  and how to defer installations using the PowerShell App Deployment Toolkit.

Feel free to leave a comment below, and share how you use defer.

 

As a last thing i would like to share the full help information on Show-InstallationWelcome

NAME
    Show-InstallationWelcome
    
SYNOPSIS
    Show a welcome dialog prompting the user with information about the installation and actions to be performed before
     the installation can begin.
    
    
SYNTAX
    Show-InstallationWelcome [[-CloseApps] <String>] [-Silent] [[-CloseAppsCountdown] <Int32>] [[-ForceCloseAppsCountdo
    wn] <Int32>] [-PromptToSave] [-PersistPrompt] [-BlockExecution] [-AllowDefer] [-AllowDeferCloseApps] [[-DeferTimes]
     <Int32>] [[-DeferDays] <Int32>] [[-DeferDeadline] <String>] [-CheckDiskSpace] [[-RequiredDiskSpace] <Int32>] [[-Mi
    nimizeWindows] <Boolean>] [[-TopMost] <Boolean>] [[-ForceCountdown] <Int32>] [-CustomText] [<CommonParameters>]
    
    
DESCRIPTION
    The following prompts can be included in the welcome dialog:
     a) Close the specified running applications, or optionally close the applications without showing a prompt (using 
    the -Silent switch).
     b) Defer the installation a certain number of times, for a certain number of days or until a deadline is reached.
     c) Countdown until applications are automatically closed.
     d) Prevent users from launching the specified applications while the installation is in progress.
    Notes:
     The process descriptions are retrieved from WMI, with a fall back on the process name if no description is availab
    le. Alternatively, you can specify the description yourself with a '=' symbol - see examples.
     The dialog box will timeout after the timeout specified in the XML configuration file (default 1 hour and 55 minut
    es) to prevent SCCM installations from timing out and returning a failure code to SCCM. When the dialog times out, 
    the script will exit and return a 1618 code (SCCM fast retry code).
    

PARAMETERS
    -CloseApps <String>
        Name of the process to stop (do not include the .exe). Specify multiple processes separated by a comma. Specify
         custom descriptions like this: "winword=Microsoft Office Word,excel=Microsoft Office Excel"
        
    -Silent [<SwitchParameter>]
        Stop processes without prompting the user.
        
    -CloseAppsCountdown <Int32>
        Option to provide a countdown in seconds until the specified applications are automatically closed. This only t
        akes effect if deferral is not allowed or has expired.
        
    -ForceCloseAppsCountdown <Int32>
        Option to provide a countdown in seconds until the specified applications are automatically closed regardless o
        f whether deferral is allowed.
        
    -PromptToSave [<SwitchParameter>]
        Specify whether to prompt to save working documents when the user chooses to close applications by selecting th
        e "Close Programs" button. Option does not work in SYSTEM context unless toolkit launched with "psexec.exe -s -
        i" to run it as an interactive process under the SYSTEM account.
        
    -PersistPrompt [<SwitchParameter>]
        Specify whether to make the prompt persist in the center of the screen every 10 seconds. The user will have no 
        option but to respond to the prompt. This only takes effect if deferral is not allowed or has expired.
        
    -BlockExecution [<SwitchParameter>]
        Option to prevent the user from launching the process/application during the installation.
        
    -AllowDefer [<SwitchParameter>]
        Enables an optional defer button to allow the user to defer the installation.
        
    -AllowDeferCloseApps [<SwitchParameter>]
        Enables an optional defer button to allow the user to defer the installation only if there are running applicat
        ions that need to be closed.
        
    -DeferTimes <Int32>
        Specify the number of times the installation can be deferred.
        
    -DeferDays <Int32>
        Specify the number of days since first run that the installation can be deferred. This is converted to a deadli
        ne.
        
    -DeferDeadline <String>
        Specify the deadline date until which the installation can be deferred.
        Specify the date in the local culture if the script is intended for that same culture.
        If the script is intended to run on EN-US machines, specify the date in the format: "08/25/2013" or "08-25-2013
        " or "08-25-2013 18:00:00"
        If the script is intended for multiple cultures, specify the date in the universal sortable date/time format: "
        2013-08-22 11:51:52Z"
        The deadline date will be displayed to the user in the format of their culture.
        
    -CheckDiskSpace [<SwitchParameter>]
        Specify whether to check if there is enough disk space for the installation to proceed.
        If this parameter is specified without the RequiredDiskSpace parameter, the required disk space is calculated a
        utomatically based on the size of the script source and associated files.
        
    -RequiredDiskSpace <Int32>
        Specify required disk space in MB, used in combination with CheckDiskSpace.
        
    -MinimizeWindows <Boolean>
        Specifies whether to minimize other windows when displaying prompt. Default: $true.
        
    -TopMost <Boolean>
        Specifies whether the windows is the topmost window. Default: $true.
        
    -ForceCountdown <Int32>
        Specify a countdown to display before automatically proceeding with the installation when a deferral is enabled
        .
        
    -CustomText [<SwitchParameter>]
        Specify whether to display a custom message specified in the XML file. Custom message must be populated for eac
        h language section in the XML.
        
    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see 
        about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 
    
    -------------------------- EXAMPLE 1 --------------------------
    
    PS C:\>Show-InstallationWelcome -CloseApps 'iexplore,winword,excel'
    
    Prompt the user to close Internet Explorer, Word and Excel.
    
    
    
    
    -------------------------- EXAMPLE 2 --------------------------
    
    PS C:\>Show-InstallationWelcome -CloseApps 'winword,excel' -Silent
    
    Close Word and Excel without prompting the user.
    
    
    
    
    -------------------------- EXAMPLE 3 --------------------------
    
    PS C:\>Show-InstallationWelcome -CloseApps 'winword,excel' -BlockExecution
    
    Close Word and Excel and prevent the user from launching the applications while the installation is in progress.
    
    
    
    
    -------------------------- EXAMPLE 4 --------------------------
    
    PS C:\>Show-InstallationWelcome -CloseApps 'winword=Microsoft Office Word,excel=Microsoft Office Excel' -CloseAppsC
    ountdown 600
    
    Prompt the user to close Word and Excel, with customized descriptions for the applications and automatically close 
    the applications after 10 minutes.
    
    
    
    
    -------------------------- EXAMPLE 5 --------------------------
    
    PS C:\>Show-InstallationWelcome -CloseApps 'winword,msaccess,excel' -PersistPrompt
    
    Prompt the user to close Word, MSAccess and Excel.
    By using the PersistPrompt switch, the dialog will return to the center of the screen every 10 seconds so the user 
    cannot ignore it by dragging it aside.
    
    
    
    
    -------------------------- EXAMPLE 6 --------------------------
    
    PS C:\>Show-InstallationWelcome -AllowDefer -DeferDeadline '25/08/2013'
    
    Allow the user to defer the installation until the deadline is reached.
    
    
    
    
    -------------------------- EXAMPLE 7 --------------------------
    
    PS C:\>Show-InstallationWelcome -CloseApps 'winword,excel' -BlockExecution -AllowDefer -DeferTimes 10 -DeferDeadlin
    e '25/08/2013' -CloseAppsCountdown 600
    
    Close Word and Excel and prevent the user from launching the applications while the installation is in progress.
    Allow the user to defer the installation a maximum of 10 times or until the deadline is reached, whichever happens 
    first.
    When deferral expires, prompt the user to close the applications and automatically close them after 10 minutes.