Get started Bring yourself up to speed with our introductory content.

How to create Windows 10 toast notifications with PowerShell

IT can send pop-up notifications to a Windows 10 user's taskbar with a PowerShell module called BurntToast. Here's how to get started creating toast notifications.

With the BurntToast PowerShell module, IT can communicate with Windows 10 users in an entirely new way.

Notifications that pop-up from the Windows 10 taskbar are called toast notifications and are similar to push notifications on a mobile device. Windows 10 toast notifications can be simple or more interactive, giving the user options to choose certain items. For example, the user can choose to hit snooze when an alarm clock notification displays.

The use cases for Windows 10 toast notifications are broad, but the ability for IT to send notifications directly to a user's taskbar instead of sending an email, instant message or phone call can be useful.

Installing BurntToast

A PowerShell module called BurntToast provides users with a method to display these Windows 10 toast notifications with PowerShell.

The BurntToast module is available in the PowerShell Gallery, so installing it is easy. First, run:

PS C:\> Install-Module BurntToast

In most cases, the module is not installed on a machine or in a PowerShell session. To view the commands in the module, use:

Get-Command: PS C:\> Get-Command -Module BurntToast

This will display all of the commands associated with the module (Figure 1).

commands
Figure 1: A list of commands associated with the BurntToast module

Creating Windows 10 toast notifications

First, there are some restrictions on how to use BurntToast. Currently, there isn't a way to create a toast notification on a remote machine, so it's not possible to send a toast notification to many users at once.

Admins can display a toast notification with just text. For example, here is how to use the New-BurntToastNotification command to show the text 'Whoa we are toasted!'

PS C:\> New-BurntToastNotification -Text 'Whoa we are toasted'

The console should display the text (Figure 2).

Text notification
Figure 2: A toast notification with text

Now IT pros can get more creative. With toast notifications, IT can also add buttons and pictures. In this example, IT can create a toast notification for a button that opens up the webpage for Wilson Sporting Goods. To do this, IT pros should use the New-BTButton command:

PS C:\> $button = New-BTButton -Content 'Wilson' -Arguments 'https://www.wilson.com/en-us'

Then, IT pros can use the $button variable and add that to a new toast notification. With the New-BurntToastNotification command, IT can add a GIF file (Figure 3).

PS C:\> New-BurntToastNotification -Text 'Wilson!' -AppLogo 'C:\island.gif' -Button $button

Button notification
Figure 3: A toast notification with a button

It is also possible to create a progress bar inside a toast notification with the cmdlet New-BTProgressBar. In this example, IT can display the status Working on something in a toast notification as the progress bar is moving (Figure 4).

$test = New-BTProgressBar -Status 'Working on something' -Indeterminate

PS C:\> New-BurntToastNotification -ProgressBar $test -Text 'Working'

Progress bar notification
Figure 4: A toast notification with a progress bar

Chocolatey is a package manager for Windows that IT can use with the Windows command-line interface with CMD or PowerShell.

In this example, IT can install a few packages on a local machine. After each installation is successful, a toast notification will pop up and state its success.

First, place the name of the packages into a variable.

PS C:\> $Packages = 'googlechrome','firefox','vlc'

Next, IT can pipe this to the ForEach-Object cmdlet in PowerShell to install each package one by one. If they are successful, which means that the $LASTEXITCODE variable is 0, the toast notification will pop up (Figure 5).

PS C:\> $Packages | ForEach-Object {choco install $_ -y;if ($LASTEXITCODE -eq 0){New-BurntToastNotification -Text "$_ installed"}}

Installation notification
Figure 5: A toast notification to alert users that the installation is complete

For a cleaner option, a Chocolatey extension can create Windows 10 toast notifications using BurntToast. After IT installs this extension, any package that the end user installs will automatically receive a toast notification with the package name, version and a link to the package webpage (Figure 6).

PS C:\> choco install firefox -y

Notification with package webpage
Figure 6: A toast notification with a link to the package webpage

Dig Deeper on Windows 10 security and management

Join the conversation

1 comment

Send me notifications when other members comment.

Please create a username to comment.

Do you use toast notifications in Windows 10 to communicate with users? Why or why not?
Cancel

-ADS BY GOOGLE

SearchVirtualDesktop

SearchWindowsServer

Close