Skip to content

Instantly share code, notes, and snippets.

Created November 16, 2018 19:48
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Create a WIndows 10 Toast notification using .Net
Function New-DotNetToast {
[Parameter(Mandatory, Position = 0)]
[Parameter(Mandatory,Position = 1)]
[Parameter(Position = 2)]
$Logo = "C:\Program Files\WindowsPowerShell\Modules\BurntToast\0.6.2\Images\BurntToast.png"
$XmlString = @"
<binding template="ToastGeneric">
<image src="$Logo" placement="appLogoOverride" hint-crop="circle" />
<audio src="ms-winsoundevent:Notification.Default" />
$AppId = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
#Add-Type -Path 'C:\Program Files\WindowsPowerShell\Modules\BurntToast\0.6.2\lib\Microsoft.Toolkit.Uwp.Notifications\Microsoft.Toolkit.Uwp.Notifications.dll'
$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
$null = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]
$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::new()
$Toast = [Windows.UI.Notifications.ToastNotification]::new($ToastXml)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment