PRUEBA AHORA
Pro Tips

Custom Windows Notifications

3 min. read
12/08/2022
By Esben Dochy
ProTips-28

Pro Tips with Esben #28

Patches and updates often require a system reboot to fully complete, but how do you manage that users reboot their devices when they need to and how can you add some additional pressure? That’s what we’re looking at today!

The most obvious use-case is Windows Updates. Hopefully, you’ll already have some things in place to encourage users to reboot after updates have been completed. Microsoft has a wide range of group policies that can help you configure when users get alerted and forced to reboot.

If you want to use Lansweeper to collect data on group policies, you can scan them using custom registry scanning and report on them. One extremely useful resource to find which group policy is stored in which registry key is the GP Search website which lets you search for group policies and shows all kinds of data, including what registry keys are used. I’ve even used this in Pro Tips 21, to scan an IE11 GP.

Custom Windows Toast Notifications

You’re probably familiar with Windows Toast notifications, the annoying popups in your lower right-hand corner. They get used for what feels like every action Windows takes. However, you can also create your own which can be used to alert users to reboot or convey whatever message you want. Just another reason for users to be kind to you…

Toast Notification

PowerShell Script

Credit where credit’s due, Andy_Sismey on the community made a script that lets you deploy a notification and include an image as well.

You can also download it here.

Some notes on the script, if you’d like to add an image, you’ll need to adjust the paths within the script. The first item is to copy the image to the local machine:

copy-Item "***Path To Images***imagesreboot.png" -Destination "C:temp"

The second item is for the notification to know where to grab the image:

<image placement="inline" src="c:tempreboot.png" />

Lastly, you’ll also notice that there are fields to adjust the notification title and message:

<text>Computer Reboot Required</text>
<text>Please reboot your computer to complete the installation of NEW Features and Important Updates.</text>

Deployment Package

If you’d like to use the script, you can do so using this deployment package.

One thing that is crucial, is that the deployment is performed using the “currently logged on” run mode. This is the only option to actually display the notification to the user. Unfortunately, this will cause the command prompt windows to open briefly which might confuse users.

Combining Additional Resources

All of the above are just the basics to start using a custom toast notification. But, by adjusting the notification and the deployment package, you can make the notifications more targeted.

One example is by adding a Condition step in the deployment package. You could add the condition that the notification is only deployed if a registry key indicates that there is a pending reboot. You can even find this registry key in the very first Pro Tips I did. You can even make the asset reboot after a delay if you really want to force it.

Alternatively, you could use an uptime report (with some minor adjustments), deploy it to all workstations with a long uptime and/or force the reboot.