Windows Toast通知未显示在Action Center中

时间:2016-05-30 05:39:06

标签: windows notifications

需要一些帮助。我让这个脚本在Power shell中用于Win 10中的Toast通知,但通知不会在Action Center中显示。任何帮助将不胜感激。

     param(
        [String] $Title
    )

    [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
    [Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
    [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null




$template = @"
    <toast duration = "long">
        <visual>
            <binding template="ToastGeneric">
                <text id="1">Hello World</text>
                <text id="2">How are you Today?</text>
                <text id="3">Can we Script something Great today?</text>
            </binding>
        </visual>
        <audio src="ms-winsoundevent:Notification.Reminder"/>
      </toast>
"@


    $xml = New-Object Windows.Data.Xml.Dom.XmlDocument
    $xml.LoadXml($template)
    $toast = New-Object Windows.UI.Notifications.ToastNotification $xml

    [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("Visa Client Engineering").Show($toast)

1 个答案:

答案 0 :(得分:3)

您必须创建一个注册表项。

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings\Visa Client Engineering

创建名为ShowInActionCenter的值为1的DWORD。