Display a notification on Windows 10 with PowerShell [Quick Guide]

4:16 pm March 9, 201713359

I. introduction

Windows 10 users are certainly familiar with the notifications within the system operating, these appear on trigger on the part of one of your applications , for example: you receive an email, your antivirus detects an infection , your computer goes into power saving mode, etc… It is possible to create and display its own notification bubbles in Windows 10 thanks PowerShell .

The commandlets for this operation are not included by default, we’ll rely once more on the PowerShell community, and more particularly on the module Burnt Toast , that can be translated in french by “ toast”. Here’s the link to the module: Burnt Toast for PowerShell

the goal of this tutorial is to show you how to create a notification, free to you then to piggyback this functionality in your scripts for more interaction with the environment of the user.

The video version of this tutorial is available on YouTube:

II. Install the module Burnt Toast

Let’s start by installing the module Burnt Toast, simply using a PowerShell console:

 Install - Module BurntToast 

installation is done quickly.

Then we can take the opportunity to list the available cmdlets:

 PS C: > Get-Command - Module BurntToast CommandType Name Source Version - - --Function Get-BTFunctionLevel 0.5.1 BurntToast Function New-BTAppId 0.5.1 BurntToast Function New-BurntToastNotification 0.5.1 BurntToast Function Set-BTFunctionLevel 0.5.1 BurntToast 

it is worth noting that by default the module load Basic mode with a limited number of cmdlets, it is possible to switch on the Advanced mode to access the specific functions of customization of the notifications. It will use the following command and reopen its PowerShell console:

 Set-BTFunctionLevel Advanced 

there will be more cmdlets:

 CommandType Name Source Version ----Function Get-BTFunctionLevel 0.5.1 BurntToast Function New-BTAction 0.5.1 BurntToast Function New-BTAppId 0.5.1 BurntToast Function New-BTAudio 0.5.1 BurntToast Function New-BTBinding 0.5.1 BurntToast Function New-BTButton 0.5.1 BurntToast Function New-BTContent 0.5.1 BurntToast Function do w - BTContextMenuItem 0.5.1 BurntToast Function New-BTImage 0.5.1 BurntToast Function New-BTInput 0.5.1 BurntToast Function New-BTSelectionBoxItem 0.5.1 BurntToast Function New-BTText 0.5.1 BurntToast Function New-BTVisual 0.5.1 BurntToast Function New-BurntToastNotification 0.5.1 BurntToast Function Set-BTFunctionLevel 0.5.1 BurntToast Function Submit-BTNotification 0.5.1 BurntToast 

III. New-BurntToastNotification

before you create a notification with the New-BurntToastNotification cmdlet, it will perform a slight configuration to declare our “application” that will be our pseudo-source, that raises the event. Otherwise you will get this message to every creation of a notification:

 warning: The AppId BurntToast is not present in the registry, please run New-BTAppId to avoid inconsistent Toast behaviour. 

To create a new app, we’ll use the following command:

 New-BTAppId - AppId "IT-Connect" 

then here’s how to create a notification without setting you will have a default notification:

 New-BurntToastNotification 

which is not very interesting, but which allows to check the good operation of the module. To create a custom notification:

 New-BurntToastNotification - AppId "Connect IT" - AppLogo "C:templogo.png" - Text "PowerShell Notification", "This module is very cool! :-)" 

Below a diagram made by myself to help you understand the purpose of each parameter, since you can make the link between each parameter and its impact on the display of the notification:

in the example above, there is a parameter named “Sound” which allows to play a sound at the time of the notification and that I had not mentioned. By default, it accepts different values corresponding to predefined sounds. See for yourself:

it is worth noting that different triggered notifications will be visible directly in the center of Windows 10 notifications, like this:

this very simple module to use as we have just seen, can be very useful to interact with the user environment. An interesting example that I saw and the use of this system of notifications to track deployments of images with MDT/WDS, I direct you to article on SystAndDeploy: MDT and notifications

and you, how do you exploit this module?