Skip to content

Instantly share code, notes, and snippets.

View M-Shabrawy's full-sized avatar

Mohamed Al-Shabrawy M-Shabrawy

View GitHub Profile
@M-Shabrawy
M-Shabrawy / ToastNotification_Windows10.ps1
Created December 13, 2017 03:56 — forked from altrive/ToastNotification_Windows10.ps1
Windows 10 toast notification sample
$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