PowerShell Toast Notifications

The following example PowerShell script was created to demonstrate the usage of Toast Notifications using Windows PowerShell. Toast Notifications can be useful to inform users that an event is about to take place on their Windows device.

The code stores its configuration in an associated xml config file called mw_toast.xml which resides in the same folder as the calling script. This can be used to customise any messages and change selected behaviour of the notification that is presented to the user.

The logo and hero images are hard coded as Base64 strings and then written to the device temp folder at runtime. This was done as Windows Toast notifications seem to require any images to reside on disk rather than in memory.

The .ps1 code is presented below along with the XML config file; The code has been tested and works on Windows 10/11. A zipped version of the .ps1 code along with the XML config file can be downloaded by clicking the download button in the page sidebar.

PowerShell Code

XML Config File