A new update to the Windows 10 Toast Notification Script is a reality. Now being on version 1.5.
I’m receiving a lot of feedback and questions related to the Windows 10 Toast Notification Script and that makes me really happy. I’m trying my best to get back to each and everyone.
One question I’m receiving often, is how one is able to run a Task Sequence directly from the action/install button in the actual toast notification. Therefore I figured I’d do everyone good and make it a native option in the script itself.
I have previously covered how one can initiate a reboot, also directly from the action button. This post is available from here: https://www.imab.dk/windows-10-toast-notification-script-update-personal-greeting-and-protocol-based-reboot/
- 1.5 – Added new option to run task sequences (PackageID) directly from the toast notification action button. Enable the option <RunPackageID> in the config.xml
- Fixed a few script errors when running the script on a device without ConfigMgr client
The new option which enables you to run a task sequence directly from the Install/Action button is highlighted below.
To enable the option, simply configure RunPackageID to Enabled=”True” and specify the Package ID of the task sequence in the Value field: Value=”KR10097″
The Package ID of the task sequence can be found in the Configuration Manager console when browsing your task sequences. See below illustration:
How does it work?
In order for this to work, you need to create a custom protocol in Windows 10. The easiest approach is to install this through the attached .MSI I provide in the download:
Windows 10 Toast Notification Script Custom Action Protocols.msi
The installation currently comes with two custom protocols. The one of interest in this example, is the one called ToastRunPackageID. The installer creates below registry entries:
This enables us to use ToastRunPackageID: as an action in the config.xml, which in return launches the referenced ToastRunPackageID.cmd.
The installation also drops some local files into ProgramData\ToastNotificationScript. The current content is illustrated below and currently consists of 3 files:
- ToastReboot.cmd (not used in this example)
The process may seem complicated, but it’s not. I will try to explain the sequence of actions here:
- Toast Notification Script run and tattoos the registry with the PackageID of the Task Sequence into HKCU:\SOFTWARE\ToastNotificationScript
- When clicking the action/install button of the toast notification, the protocol ToastRunPackageID: is being initiated
- This launches the ToastRunPackageID.cmd, which again launches the final Powershell script: Run-PackageID.ps1
- Run-PackageID.ps1 dynamically picks up the PackageID from the registry and launches this Task Sequence directly on the device
- This makes sure you never have to edit any of the local files. Only the config.xml will ever need editing.
If anything needs further explaining, don’t hesitate to reach out to me on Twitter or in the comments section down below.