The code that first initializes $allApplicationAssociationToasts will cause $allApplicationAssociationToasts to be a string, rather than an array, if the original call returns 1 result. This leads to the resultant buildup of a string, not an array, by the subsequent calls, which isn't right.
While fixing this, I rewrote portions of $allApplicationAssociationToasts to be (at least in my opinion) easier to read and troubleshoot. I believe it is functionally identical, however YMMV.
Tested on Powershell 7 w/ StrictMode -Version 3
Submitting my proposed changes back. Sorry that this is just raw code, not a diff. I can convert to diff if desired.
Issues:
The code that first initializes $allApplicationAssociationToasts will cause $allApplicationAssociationToasts to be a string, rather than an array, if the original call returns 1 result. This leads to the resultant buildup of a string, not an array, by the subsequent calls, which isn't right.
While fixing this, I rewrote portions of $allApplicationAssociationToasts to be (at least in my opinion) easier to read and troubleshoot. I believe it is functionally identical, however YMMV.
Tested on Powershell 7 w/ StrictMode -Version 3
Submitting my proposed changes back. Sorry that this is just raw code, not a diff. I can convert to diff if desired.