{"id":3232,"date":"2020-12-07T16:45:50","date_gmt":"2020-12-07T15:45:50","guid":{"rendered":"https:\/\/www.mariotti.de\/?p=3232"},"modified":"2020-12-07T16:45:50","modified_gmt":"2020-12-07T15:45:50","slug":"windows-toast-notification-mittels-powershell","status":"publish","type":"post","link":"https:\/\/dev.mariotti.de\/?p=3232","title":{"rendered":"Windows Toast Notification mittels PowerShell"},"content":{"rendered":"<p>Beispiel:<\/p>\n<p><code>Function New-ToastMessage {<br \/>\n[cmdletBinding()]<br \/>\nParam(<br \/>\n[Parameter(Mandatory, Position = 0)]<br \/>\n[String]<br \/>\n$Title,<br \/>\n[Parameter(Mandatory,Position = 1)]<br \/>\n[String]<br \/>\n$Message,<br \/>\n[Parameter(Position = 2)]<br \/>\n[String]<br \/>\n$Logo = \"C:\\Windows\\appcompat\\UA\\GenericApp.png\",<br \/>\n[Parameter(Position = 3)]<br \/>\n[String]<br \/>\n$HintCrop = \"circle\"<br \/>\n)<br \/>\n$XmlString = @\"<br \/>\n&lt;toast&gt;<br \/>\n&lt;visual&gt;<br \/>\n&lt;binding template=\"ToastGeneric\"&gt;<br \/>\n&lt;text&gt;$Title&lt;\/text&gt;<br \/>\n&lt;text&gt;$Message&lt;\/text&gt;<br \/>\n&lt;image src=\"$Logo\" placement=\"appLogoOverride\" hint-crop=\"$HintCrop\" \/&gt;<br \/>\n&lt;\/binding&gt;<br \/>\n&lt;\/visual&gt;<br \/>\n&lt;audio src=\"ms-winsoundevent:Notification.Default\" \/&gt;<br \/>\n&lt;\/toast&gt;<br \/>\n\"@<br \/>\n$AppId = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\\WindowsPowerShell\\v1.0\\powershell.exe'<br \/>\n$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]<br \/>\n$null = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]<br \/>\n$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::New()<br \/>\n$ToastXml.LoadXml($XmlString)<br \/>\n$Toast = [Windows.UI.Notifications.ToastNotification]::New($ToastXml)<br \/>\n[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppId).Show($Toast)<br \/>\n}<br \/>\nNew-ToastMessage -Title \"Test Title\" -Message \"Test Message\"<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ich zeige eine simple Funktion zum erstellen von sogenannten Windows Toast Benachrichtigungen<\/p>\n","protected":false},"author":2,"featured_media":2425,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37],"tags":[],"class_list":["post-3232","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"_links":{"self":[{"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/posts\/3232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3232"}],"version-history":[{"count":0,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/posts\/3232\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/media\/2425"}],"wp:attachment":[{"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}