System events on Windows 10 trigger toast notifications. These notifications can also be sent by apps to let you know, for example, that you have a new email message. Developers have the option to add support for the Windows 10 toast notifications. They’re pretty useful but can only be triggered by a system or app event. You cannot configure notifications to appear in response to, for example, a scheduled task running. There’s no built-in UI that can do that. The good news is, it’s not that hard to show a custom toast notification on Windows 10. All you need is a simple PowerShell script.
This tutorial works on Windows 10. You must be running PowerShell version 5+. You must have administrative rights on your system.
Check PowerShell Version
Open PowerShell. In Windows search, type PowerShell, right-click it, and select ‘Run as administrator’, from the context menu. In the PowerShell window, type the following;
Look at what the Version line returns to check the PowerShell Version. If you’re running the latest version of Windows 10 i.e. the Fall Creators Update, you probably have PowerShell v5.
Install BurntToast Module
Make sure you’re running PowerShell with administrative rights. In order to show custom toast notifications on Windows 10, you will need to install the BurntToast module. This module lets you create custom toast notifications on Windows 10 with little to no effort, and zero coding skills.
In PowerShell, enter the following,
Install-Module -Name BurntToast
You will, likely get a message that says you need to install the NuGet provider. If you do, simply type in Y to proceed and PowerShell will take care of the rest. Once it’s installed, run the above command again.
This time, you will likely get a message saying you’re installing a module from an untrusted repository. Again, type Y to proceed. The module will now be installed.
Custom Toast Notification
Now that you’ve installed the module, you can create your custom toast notification. A custom toast notification on Windows 10 has three parts that you need to concern yourself with;
- A title
- The message body
- An icon
Find a nice JPG or PNG image that you can use for the icon. The icon will appear in the toast notification. All the notifications will be sent from PowerShell so it’s a good idea to use an icon that will tell you a bit about what the notification is for.
Open Notepad and paste the following in it;
New-BurntToastNotification -Text "Title of notifications", 'Body of notification' -AppLogo path to your icon image
Replace Title of notification with the title of your notification. Do not remove any of the inverted commas or apostrophes. Simple replace the text where required. Save the file with the ps1 file extension.
The following is the custom toast notification we generated using BurntToast;
New-BurntToastNotification -Text "Power cable plugged/Unplugged", 'Power source has changed' -AppLogo C:\Users\fatiw\Desktop\power-plug-png-image-69656.png
When you run the PS1 file (with PowerShell), the toast notification will appear on your screen.
You can dismiss it like other Windows 10 notifications. In the Action Center, these notifications will all appear under PowerShell. You cannot change the size of the notification. The background color will always be the same as the accent color you’ve picked in Windows 10. The notification will conform to the default settings for notifications on Windows 10. When you run the PowerShell script, a PowerShell window will open for a brief second and close automatically. This is normal and nothing to worry about.
You can use the Task Scheduler to trigger the notification.