Created
November 2, 2018 03:24
-
-
Save twilight-sparkle-irl/ad68e30b086dcf29c54255cf712a83c3 to your computer and use it in GitHub Desktop.
invoke-windowsdefendertoast
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function Invoke-WindowsDefenderToast { | |
| Param ( | |
| [Parameter(Mandatory=$True)] | |
| [string]$Message, | |
| [Parameter()] | |
| [string]$Title="Virus & threat protection" | |
| ) | |
| [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | |
| [xml]$ToastTemplate = @" | |
| <toast launch="app-defined-string"> | |
| <visual> | |
| <binding template="ToastGeneric"> | |
| <text>$Title | |
|  </text> | |
| <text>$Message</text> | |
| </binding> | |
| </visual> | |
| </toast> | |
| "@ | |
| $ToastXml = New-Object -TypeName Windows.Data.Xml.Dom.XmlDocument | |
| $ToastXml.LoadXml($ToastTemplate.OuterXml) | |
| $notify = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("Microsoft.Windows.SecHealthUI_cw5n1h2txyewy!SecHealthUI") | |
| $notify.Show($ToastXml) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment