Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Add-WindowsNotification{
- Param(
- [parameter(Mandatory=$true)][ValidatePattern('^[\w\-]+$')][String]$AppId,
- [parameter(Mandatory=$true)][ValidateLength(1,108)][String]$Message
- )
- $notificationTemplate = [Windows.UI.Notifications.ToastTemplateType]::ToastText01
- $notification = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent($notificationTemplate)
- $textElement = $notification.SelectSingleNode('/toast/visual/binding/text')
- $textElement.innerText = $message
- $notificationInstance = New-Object Windows.UI.Notifications.ToastNotification $notification
- $notificationManager = [Windows.UI.Notifications.ToastNotificationManager]::GetDefault()
- $notifier = $notificationManager.CreateToastNotifier($AppId)
- $notifier.show($notificationInstance)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement