Custom Protocol Support For Notification itself

This allows for a custom protocol to be called when the Notification itself is called. For example could be used to get around Toast Notifications ability to be dismissed. If the user clicks the notification you could trigger the notification to be displayed again. Also useful to perform the same action as one of the protocols assigned to the action buttons.
This commit is contained in:
ASAJacob 2022-01-22 13:58:55 -07:00 committed by GitHub
parent 9064a66938
commit 4826666254
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 46 additions and 38 deletions

View file

@ -82,18 +82,18 @@
** As well as added support for dynamic deadline retrieval for software updates **
** Stuff has been rewritten to suit my understanding and thoughts of the script **
2.0.0 - Huge changes to how this script handles custom protocols
Added Support for Custom Actions/Protocols within the script under user context removing the need for that to be run under SYSTEM/ADMIN
- <Option Name="Action" Value="ToastRunUpdateID:" />
- <Option Name="Action" Value="ToastRunPackageID:" />
- <Option Name="Action" Value="ToastRunApplicationID:" />
- <Option Name="Action" Value="ToastReboot:" />
Added Support to dynamically create Custom Action Scripts to support Custom Protocols
Added Support for Software (Feature) Updates : Searches for an update and will store in variable
Added new XML Types for Software Updates:
- <Option Name="RunUpdateID" Enabled="True" Value="3012973" />
- <Option Name="RunUpdateTitle" Enabled="True" Value="Version 1909" />
Added support for getting deadline date/time dynamically for software updates
2.0.0 - Huge changes to how this script handles custom protocols
Added Support for Custom Actions/Protocols within the script under user context removing the need for that to be run under SYSTEM/ADMIN
- <Option Name="Action" Value="ToastRunUpdateID:" />
- <Option Name="Action" Value="ToastRunPackageID:" />
- <Option Name="Action" Value="ToastRunApplicationID:" />
- <Option Name="Action" Value="ToastReboot:" />
Added Support to dynamically create Custom Action Scripts to support Custom Protocols
Added Support for Software (Feature) Updates : Searches for an update and will store in variable
Added new XML Types for Software Updates:
- <Option Name="RunUpdateID" Enabled="True" Value="3012973" />
- <Option Name="RunUpdateTitle" Enabled="True" Value="Version 1909" />
Added support for getting deadline date/time dynamically for software updates
- Configure DynamicDeadline with the UpdateID
2.0.1 - Updated custom action scripts!
@ -106,7 +106,7 @@
- If newer version is available from the script, new custom action scripts will be created
- This allows me to make sure the relevant scripts are in place in case I change something along the way
- Modified script output of custom script for RunPackageID to pick up Program ID dynamically
Added support for getting deadline date/time dynamically for applications
Added support for getting deadline date/time dynamically for applications
- Configure DynamicDeadline with the Application ID
2.0.2 - Fixed an error in the custom protocols
@ -1708,6 +1708,7 @@ if(-NOT[string]::IsNullOrEmpty($Xml)) {
$Scenario = $Xml.Configuration.Option | Where-Object {$_.Name -like 'Scenario'} | Select-Object -ExpandProperty 'Type'
$Action1 = $Xml.Configuration.Option | Where-Object {$_.Name -like 'Action1'} | Select-Object -ExpandProperty 'Value'
$Action2 = $Xml.Configuration.Option | Where-Object {$_.Name -like 'Action2'} | Select-Object -ExpandProperty 'Value'
$LaunchProtocol = $Xml.Configuration.Option | Where-Object {$_.Name -like 'LaunchProtocol'} | Select-Object -ExpandProperty 'Value'
$GreetGivenName = $Xml.Configuration.Text | Where-Object {$_.Option -like 'GreetGivenName'} | Select-Object -ExpandProperty 'Enabled'
$MultiLanguageSupport = $Xml.Configuration.Text | Where-Object {$_.Option -like 'MultiLanguageSupport'} | Select-Object -ExpandProperty 'Enabled'
# Load Toast Notification buttons
@ -2268,7 +2269,7 @@ if ($GreetGivenName -eq "True") {
if (($ActionButton1Enabled -eq "True") -AND ($DismissButtonEnabled -eq "True")) {
Write-Log -Message "Creating the xml for action button and dismiss button"
[xml]$Toast = @"
<toast scenario="$Scenario">
<toast scenario="$Scenario" activationType= "protocol" launch="$LaunchProtocol">
<visual>
<binding template="ToastGeneric">
<image placement="hero" src="$HeroImage"/>
@ -2304,7 +2305,7 @@ if (($ActionButton1Enabled -eq "True") -AND ($DismissButtonEnabled -eq "True"))
if (($ActionButton1Enabled -ne "True") -AND ($DismissButtonEnabled -ne "True")) {
Write-Log -Message "Creating the xml for no action button and no dismiss button"
[xml]$Toast = @"
<toast scenario="$Scenario">
<toast scenario="$Scenario" activationType= "protocol" launch="$LaunchProtocol">
<visual>
<binding template="ToastGeneric">
<image placement="hero" src="$HeroImage"/>
@ -2338,7 +2339,7 @@ if (($ActionButton1Enabled -ne "True") -AND ($DismissButtonEnabled -ne "True"))
if (($ActionButton1Enabled -eq "True") -AND ($DismissButtonEnabled -ne "True")) {
Write-Log -Message "Creating the xml for no dismiss button"
[xml]$Toast = @"
<toast scenario="$Scenario">
<toast scenario="$Scenario" activationType= "protocol" launch="$LaunchProtocol">
<visual>
<binding template="ToastGeneric">
<image placement="hero" src="$HeroImage"/>
@ -2373,7 +2374,7 @@ if (($ActionButton1Enabled -eq "True") -AND ($DismissButtonEnabled -ne "True"))
if (($ActionButton1Enabled -ne "True") -AND ($DismissButtonEnabled -eq "True")) {
Write-Log -Message "Creating the xml for no action button"
[xml]$Toast = @"
<toast scenario="$Scenario">
<toast scenario="$Scenario" activationType= "protocol" launch="$LaunchProtocol">
<visual>
<binding template="ToastGeneric">
<image placement="hero" src="$HeroImage"/>
@ -2410,7 +2411,7 @@ if ($ActionButton2Enabled -eq "True") {
Write-Log -Message "This will always enable both action buttons and the dismiss button" -Level Warn
Write-Log -Message "Replacing any previous formatting of the toast xml" -Level Warn
[xml]$Toast = @"
<toast scenario="$Scenario">
<toast scenario="$Scenario" activationType= "protocol" launch="$LaunchProtocol">
<visual>
<binding template="ToastGeneric">
<image placement="hero" src="$HeroImage"/>
@ -2449,7 +2450,7 @@ if ($SnoozeButtonEnabled -eq "True") {
Write-Log -Message "This will always enable the action button as well as the dismiss button" -Level Warn
Write-Log -Message "Replacing any previous formatting of the toast xml" -Level Warn
[xml]$Toast = @"
<toast scenario="$Scenario">
<toast scenario="$Scenario" activationType= "protocol" launch="$LaunchProtocol">
<visual>
<binding template="ToastGeneric">
<image placement="hero" src="$HeroImage"/>