Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

TIP: Custom Install Dialog/Prompt with Proceed/Wait timer for user

So, I'm new to PDQ (still on Trial Mode, and pretty new to Powershell as well)

I'm coming from a competing deployment product that will prompt a user if they wish to proceed with an install. It will prompt the user with an option to proceed or postpone, and if the latter be reminded again in X amount of minutes (X defined by the Admin). The admin also has the option to force the install after X minutes.

It was a 'toast' like notification, which is brand-able and 'pretty'.

As powerful as PDQ is, this option is baked into the software as an option. Sure, there is the 'message' feature which calls msg.exe, but that doesn't quite cut it and is pretty antiquated. 

So, I figured I'd whip something up in Powershell to do the same. 

I'm doing this for a big Office 365 deployment, and since it takes forever, I'm opting for this process to not be silent, and I want it to be user driven due to the downtime and loss of productivity the install process takes.

The script pops-up a prompt for the user, asking them if they want to Proceed, or 'Ask Again Later'.

'Proceed' = ReturnCode 0
'Ask again in 10 minutes' = ReturnCode 1

Using Steps in the PQD Deployment Package:

  • Step1: Powershell Script (Run as 'Logged on User'), Success Code=0, command line = 'PowerShell.exe -NoLogo -ExecutionPolicy Bypass' (It needs to run interactive for the logged on user)
  • Step2: Install whatever package you need to deploy.

I then set a schedule with an interval = 10 minutes.


  • If the user presses 'Proceed', error code 0 is returned, and Step2 is initiated, which installed the desired package. Upon successful install, the PC is then removed from the deploy queue. (Make sure 'Stop deploying to targets once they succeed' is checked in Schedule > Options).
  • If the user presses 'Ask again in 10 minutes' error code 1 is returned, and the deployment is treated as a failure.  In 10 minutes, the scheduler will kick of the Package again, and the user is again prompted.  Rinse and repeat until the user has time to install the package.

Example Prompt:


After hours of scouring the net for an easy way to perform this (recall my limited PS knowledge), I found this AMAZING post by Trevor Jones, on his SMSAGENT Blog.

His function to create GUI prompts has an INSANE amount of options. This script just touches on the basics of what it offers.
I had a follow up question, and he was quick to help me out.



I added this code to Trevors function:
$window.topmost = $true
(Which makes the pop-up appear above all other windows). 

You could probably re-work the script to accept content/title/logo/etc passed to it on the command prompt, so you don't have to rework the script for every package.
And obviously create an 'Installation Complete' message - or anything for that matter.

Hope this helps others.













Date Votes
  • Such a huge help! Thank you a bunch for sharing!

    Would give cookies if i could.

  • Brilliant post. Thanks for taking the time to share. 

    It would be great to have this level of functionality and message customisation baked into PDQ.

    One question. How can I put an expiry timer on the message and upon expiration choose a exitcode? I looked on Trevor's blog and whilst I found references to the timer in the code, I wasn't sure where the put the timeout values and how to handle the action upon expiration. 

  • Actually I've moved away from the solution I posted about, and switched to this:


  • Hi Sam, could you go into a little further detail on how you use the Toast Notification Script in your deployments? It looks pretty handy. I wish PDQ had something like this built in.

  • Late to the party, but I've started using the new script that Sam mentioned as well and with my limited powershell knowledge I was wondering if anyone had tips on how to use this to give users the ability to install the update now or to snooze till later? The documentation for it is relatively sparse and geared towards SCCM, so I'm hoping someone has enabled these settings and can let me know how to get the Action Button to run a specific PDQ task? The task I need to perform is to install the mimecast plugin so I'd like to allow the users the option to continue the install which will close outlook or defer it if they're busy

  • Hi Hayden, 

    I'm using the original script which Sam referred to in his original post. I haven't yet had the time to look at the toast popup he later referred to. I'm using the original script to prompt users to update Zoom (which is typically running), they can 'update now' which closes Zoom, runs the update, and re-opens Zoom for them automatically. Or they can defer for 30 minutes. If they do nothing the options disappear after 180 seconds. Works well. Let me know if you need help on this. 
    PS: We deploy the Mimecast plugin using GPO (its the only software we deploy using GPO because, as you know, it needs to be installed when Outlook is not running, so computer startup time is ideal). 

  • Hi Michael,

    I don't know if this is Hayden's issue, but I could use some help with it if you don't mind. My issue pertains to setting up the schedule to retry after the user clicks the postpone option. I can't seem to wrap my head around that part.

  • Hi Shaun,

    Just remember that the script is just handling whether the users wants to run the upgrade now or later, then the PDQ deploy schedule handles running the script on machines which don't have the upgade (based off a PDQ inventory collection).

    This is how I have it setup for Zoom...

    Deploy task

    • Step 1 is the PowerShell script (Step 2 installs Zoom)
    • The success code for Step 1 is set to 0
    • Step 1 Options > 'run as' = logged on user
    • Step 1 Options > 'Error Mode' = Continue 
    • Deploy task Properties > Offline Settings > 'put offline targets in retry queue' = ticked.
    • Deploy task Properties > Offline Settings > 'Allowed retries' = 0 (unlimited)

    Relevant section In the script itself, 

    ####### DISPLAY MESSAGE ##########
    New-WPFMessageBox @Params -Content $StackPanel

    ####### PROCESS RESULTS ##########
    If ($WPFMessageBoxOutput -eq "Proceed with Update")
    ## TESTING CODE ###
    # Write-Output "Proceed with Update Clicked"
    $CustomExitCode = 0
    ElseIf ($WPFMessageBoxOutput -eq "Ask me again in 30 Minutes")
    ## TESTING CODE ###
    # Write-Output "Not now Clicked"
    $CustomExitCode = 1

    You can see in the script above, if user clicks "proceed", the script outputs code 0, which the Deploy task picks up as success (see bullet point #2) and moves onto step 2. If user clicks "not now", the script outputs code 1, which stops the deployment.

    If a user does nothing (I assume here they are away from their desk), then there is a part of the script which handles timeout, which also sets the exit code to 0 (success, continue with the upgrade). You set the timeout value in the parameters section of the script, around line 484 in mine. 

    # If a timeout value is provided, use a dispatcher timer to close the window when timeout is reached

    If ($Timeout) {
    $Stopwatch = New-object System.Diagnostics.Stopwatch
    $TimerCode = {
    If ($Stopwatch.Elapsed.TotalSeconds -ge $Timeout) {
    # $Window.Close()
    $CustomExitCode = 0
    $TimeoutReached = 1

    Then, associated with my deploy task is a schedule

    • Triggers = every 30 minutes
    • Targets = PDQ inventory collection called "Zoom Desktop (outdated)"
    • Packages = Zoom 
    • Options > stop deploying to targets once they succeed = unticked
    • Options > stop deploying to targets if they fail = unticked
    • Options > stop deploying to remaining queued.... = unticked

    That's it. Hope this helps?


  • Michael,

    Thank you for the detailed breakdown, and yes I believe this answers my question.

  • Thanks Sam and Michael, this works great!