Skip to content

Instantly share code, notes, and snippets.

@jkdba
jkdba / ToastNotification_Windows10.ps1
Created May 9, 2016 — forked from altrive/ToastNotification_Windows10.ps1
Windows 10 toast notification sample
View ToastNotification_Windows10.ps1
$ErrorActionPreference = "Stop"
$notificationTitle = "Notification: " + [DateTime]::Now.ToShortTimeString()
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01)
#Convert to .NET type for XML manipuration
$toastXml = [xml] $template.GetXml()
$toastXml.GetElementsByTagName("text").AppendChild($toastXml.CreateTextNode($notificationTitle)) > $null