確認環境
PSVersion 5.1.18362.1110
トースト通知を送る
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null $app = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe' $template = @" <toast> </toast> "@ $output = New-Object Windows.Data.Xml.Dom.XmlDocument $output .LoadXml( $template ) [Windows.UI.Notifications.ToastNotificationManager] ::CreateToastNotifier( $app ).show( $output ) |
変数$templateにトースト通知に表示する内容をXML形式で記述します。
このファイルを実行で内容が空のトースト通知が送られます。
リンク
ToastNotificationManager.CreateToastNotifier Method (Windows.UI.Notifications) – Windows UWP applications | Microsoft Docs
https://docs.microsoft.com/en-us/uwp/api/windows.ui.notifications.toastnotificationmanager.createtoastnotifier?view=winrt-19041
ToastNotification(XmlDocument) Constructor (Windows.UI.Notifications) – Windows UWP applications | Microsoft Docs
https://docs.microsoft.com/en-us/uwp/api/windows.ui.notifications.toastnotification.-ctor?view=winrt-19041
ToastNotifier.Show(ToastNotification) Method (Windows.UI.Notifications) – Windows UWP applications | Microsoft Docs
https://docs.microsoft.com/en-us/uwp/api/windows.ui.notifications.toastnotifier.show?view=winrt-19041