Replies: 1 comment 1 reply
-
Strictly speaking... anything is possible, unfortunately for this you've got to drop down to the .NET sort of thing to set it as I haven't exposed it through BurntToast's functions. First you need to end up with a "Toast" object: $XmlString = @"
<toast>
<visual>
<binding template="ToastGeneric">
<text>Default Notification</text>
<image src="C:\Images\BurntToast.png" placement="appLogoOverride" hint-crop="circle" />
</binding>
</visual>
<audio src="ms-winsoundevent:Notification.Default" />
</toast>
"@
$AppId = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
$null = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]
$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::new()
$ToastXml.LoadXml($XmlString)
$Toast = [Windows.UI.Notifications.ToastNotification]::new($ToastXml) Then set true on the $Toast.ExpiresOnReboot = $true Finally, show the toast: [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppId).Show($Toast) I've got a blog post on how to get the XML out of BurntToast for a notification here: https://toastit.dev/2018/08/21/crouton-8-i-like-your-code-but-i-dont-want-it-on-all-my-computers/ I'm currently working on a big update to BurntToast, I will make sure this is easily settable going forward. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When using Get-BTHistory to get history of previous toasts, there's parameter ExpiresOnReboot, which is always false. Is there a way to set it?
I'm using toasts to notify users to reboot their computers and the notifications always stays after, which is annoying.
Beta Was this translation helpful? Give feedback.
All reactions