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.
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.
PASTEBIN CODE OF MY PS SCRIPT FOR THIS EXAMPLE:
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.