From 48266662549ede4e9ed27362501558e30b55a3c1 Mon Sep 17 00:00:00 2001
From: ASAJacob <97627658+ASAJacob@users.noreply.github.com>
Date: Sat, 22 Jan 2022 13:58:55 -0700
Subject: [PATCH] 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.
---
New-ToastNotification-AppLocker-Edition.ps1 | 39 +++++++++++----------
New-ToastNotification.ps1 | 39 +++++++++++----------
config-toast-adpwexpiration.xml | 1 +
config-toast-officeupgrade.xml | 1 +
config-toast-osupgrade.xml | 1 +
config-toast-rebootpending.xml | 1 +
config-toast-waasfu.xml | 1 +
config-toast.xml | 1 +
8 files changed, 46 insertions(+), 38 deletions(-)
diff --git a/New-ToastNotification-AppLocker-Edition.ps1 b/New-ToastNotification-AppLocker-Edition.ps1
index 6cc17b4..231c51e 100644
--- a/New-ToastNotification-AppLocker-Edition.ps1
+++ b/New-ToastNotification-AppLocker-Edition.ps1
@@ -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
- -
- -
- -
- -
- 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:
- -
- -
- 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
+ -
+ -
+ -
+ -
+ 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:
+ -
+ -
+ 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 = @"
-
+
@@ -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 = @"
-
+
@@ -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 = @"
-
+
@@ -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 = @"
-
+
@@ -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 = @"
-
+
@@ -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 = @"
-
+
diff --git a/New-ToastNotification.ps1 b/New-ToastNotification.ps1
index 171bbbe..2782f28 100644
--- a/New-ToastNotification.ps1
+++ b/New-ToastNotification.ps1
@@ -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
- -
- -
- -
- -
- 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:
- -
- -
- 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
+ -
+ -
+ -
+ -
+ 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:
+ -
+ -
+ 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
@@ -1688,6 +1688,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
@@ -2211,7 +2212,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 = @"
-
+
@@ -2247,7 +2248,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 = @"
-
+
@@ -2281,7 +2282,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 = @"
-
+
@@ -2316,7 +2317,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 = @"
-
+
@@ -2353,7 +2354,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 = @"
-
+
@@ -2392,7 +2393,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 = @"
-
+
diff --git a/config-toast-adpwexpiration.xml b/config-toast-adpwexpiration.xml
index 5d7e4ac..3070f73 100644
--- a/config-toast-adpwexpiration.xml
+++ b/config-toast-adpwexpiration.xml
@@ -27,6 +27,7 @@
+
diff --git a/config-toast-officeupgrade.xml b/config-toast-officeupgrade.xml
index 90adb75..33cb74c 100644
--- a/config-toast-officeupgrade.xml
+++ b/config-toast-officeupgrade.xml
@@ -32,6 +32,7 @@
+
diff --git a/config-toast-osupgrade.xml b/config-toast-osupgrade.xml
index e12487f..2620634 100644
--- a/config-toast-osupgrade.xml
+++ b/config-toast-osupgrade.xml
@@ -27,6 +27,7 @@
+
diff --git a/config-toast-rebootpending.xml b/config-toast-rebootpending.xml
index 7681df3..e8305fa 100644
--- a/config-toast-rebootpending.xml
+++ b/config-toast-rebootpending.xml
@@ -32,6 +32,7 @@
+
diff --git a/config-toast-waasfu.xml b/config-toast-waasfu.xml
index 6d80031..f675017 100644
--- a/config-toast-waasfu.xml
+++ b/config-toast-waasfu.xml
@@ -32,6 +32,7 @@
+
diff --git a/config-toast.xml b/config-toast.xml
index d8a40e9..e692d39 100644
--- a/config-toast.xml
+++ b/config-toast.xml
@@ -32,6 +32,7 @@
+