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.
USE CASE:
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.
Process:
- 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:
CREDITS:
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.
https://smsagent.wordpress.com/2017/08/24/a-customisable-wpf-messagebox-for-powershell/
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.
PASTEBIN CODE OF MY PS SCRIPT FOR THIS EXAMPLE:
https://pastebin.com/z9PFbnYT
NOTES:
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.
-Sam
Comments
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:
https://gallery.technet.microsoft.com/Windows-10-Toast-9f228eb1
https://www.imab.dk/windows-10-toast-notification-script/
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
Relevant section In the script itself,
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.
Then, associated with my deploy task is a schedule
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!