Friday, March 9, 2018

A cleaner looking restart application

We recently started testing Anders Rodland's client health script. I really like the script, it does a great job of reporting client health issues and remediates some common client health problems.

One of the sections of his script checks to see if the client is in a pending reboot state and uses a shutdown utility by Coretech that displays a message to the end user:


This utility works perfectly fine, but my users were quite put off by its appearance. Some thought it might be malware. Unfortunately, there is no way to modify the appearance of the popup message, other than the text ("we are about to install a new version...").

If we were going to use this script and take advantage of the restart option, we needed a friendlier looking restart prompt.

Enter the PowerShell App Deployment Toolkit. This utility is excellent for a wide array of things. We typically have used it for deploying applications where we want to provide some user notification or interaction.

By using a couple of the built-in features of this utility, I was able to create a very simple restart app that uses our logo, colors, and text. We added a countdown timer to the restart window to allow the user some time to save work and close apps.

You can read their instructions for customizing the appearance and how to deploy it, but here are the commands I used for this purpose. No steps are needed in any of the sections in Deploy-Application.ps1 except for the post-installation section.
##*===============================================
##* POST-INSTALLATION
##*===============================================
[string]$installPhase = 'Post-Installation'
  
## Perform Post-Installation tasks here
        
Show-InstallationPrompt -Message 'Your computer must be restarted to complete installation of important security updates. You will be given 10 minutes to save your work and close any open applications.' -Icon Information -ButtonMiddleText 'OK'
        
Write-Log -Message "Restarting computer"
        
Show-InstallationRestartPrompt -Countdownseconds 3600 -CountdownNoHideSeconds 60


You can modify the number of seconds to suit your needs. The first number is the initial countdown, the second number is the countdown if the user clicks "Restart Later". When it runs, it looks like this: