Windows 10 Toast Notification Script Update: Run ConfigMgr Task Sequences directly from the action button

Introduction

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/

What’s New

  •   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

Config.xml

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″

Configuration Manager

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

ToastRunPackageID Protocol

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.

Local Files

The installation also drops some local files into ProgramData\ToastNotificationScript. The current content is illustrated below and currently consists of 3 files:

  • Run-PackageID.ps1
  • ToastReboot.cmd (not used in this example)
  • ToastRunPackageID.cmd

Process Explained

The process may seem complicated, but it’s not. I will try to explain the sequence of actions here:

  1. Toast Notification Script run and tattoos the registry with the PackageID of the Task Sequence into HKCU:\SOFTWARE\ToastNotificationScript
  2. When clicking the action/install button of the toast notification, the protocol ToastRunPackageID: is being initiated
  3. This launches the ToastRunPackageID.cmd, which again launches the final Powershell script: Run-PackageID.ps1
  4. 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.

Download

>> https://gallery.technet.microsoft.com/Windows-10-Toast-9f228eb1 <<

25 thoughts on “Windows 10 Toast Notification Script Update: Run ConfigMgr Task Sequences directly from the action button”

  1. Nice job with the updates. I did something similar that allows for kicking off the TS from the action button but compiled a .exe instead of the Run-PackageID.ps1 file which allowed me the ability to give the user a GUI/progress bar while the TS starting. In my testing, it can take up to a few minutes to launch the TS in some environments.

    Reply
    • Nice, thanks for sharing that with me. I haven’t seen any delay fortunately. I get the native toast saying that software is downloading and running immediately and shortly thereafter the TS progress is shown. COmpiling an .exe is not a bad idea though. 🙂

      Reply
    • Yeah, I would assume so. Might need some editing to the Run-PackageID.ps1. It definitely works for packages/programs too. 🙂

      Reply
      • Yes I was trying out it in my lab
        It Will be doable with the method of
        “Invoke-CimMethod -Namespace “root\ccm\clientSDK” -ClassName CCM_Application -ComputerName localhost -MethodName Install -Arguments”

        Credits:
        https://timmyit.com/2016/08/08/sccm-and-powershell-force-installuninstall-of-available-software-in-software-center-through-cimwmi-on-a-remote-client/

        Have to pass alot of arguments but it did work, eventually 🙂

        So yea, going to edit the Run-PackageID.ps1 script and it will work fine 🙂

        FYI:

        The older Version of the Toast, I used it as a reminder to update the BIOS Firmware here where I work, after I deployed the notification since the application is available and we gave information to run it in other channels.
        Before the Toast the number that were installing the BIOS firmware was ok but not amazing.

        After your notification and a custommade Logo we have now updated BIOS Firmware on almost 90 % of our machines

        I am very happy with those numbers 🙂

        Reply
        • Thank you – I will add that soon enough to my own edition and update the blog post. Thanks again and great to hear about your experiences 🙂

          Reply
  2. Great addition.

    One question about that new protocol you have added. If the TS is considered to be a high risk deployment (An IPU for example), will the TS kicked as soon as you click the Action button or will it shows the warning pop-up first as when you start the TS from the Software Center?

    Reply
      • Thanks for the answer.

        I will have to wait to use this new feature then and add a safeguard script that shows a window (Probably with PSADT) to replace the SCCM pop-up window. 🙂

        Reply
        • Actually, I feel like testing that scenario. I’m having seconds thoughts, as what I do is simply the same as pressing Install manually, and manually would result in that extra warning with a high risk deployment. I will be able to test that on monday 🙂

          Reply
          • Hey!

            No need to test, I just did it and I can confirm that it’s bypassing the warning message that you get when starting from the Software Center. I will try to take some time to look at what you did and see if I can change this behavior to trigger this same warning or if in this kind of scenario, I have to rely on a custom warning message.

  3. Thanks for all the hard work you have put into this whole Toast notification project. Your script was the first I was able to truly work through, dissect and learn what it was doing so I could adapt it for use with our RMM. I slimmed the whole thing down to just the powershell essentials (since we don’t use ConfigMgr), then combined this with a few other powershell functions and a bit of logic, and now I have something that will work very nicely for us.

    I have a controller script (running as the system account) which creates the various registry keys needed for the URI handlers. It then copies the stand-alone Toast notifications script and images needed to a folder on the local drive. (The URIs point to the cmd files in this location.) Finally, the script kicks off a scheduled task set to run the actual Toast notification script 30 seconds in the future as the logged in user. The scheduled task launches a vbs script (for the invisible window), then launches the powershell script to send the selected notification to the end-user.

    For the reboot required Toast, the user has two options (provided they don’t dismiss the Toast)–reboot now, and reboot at 2AM. The 2AM script is just a batch file that determines the number of seconds between now and 2AM local time and runs “shutdown /t XXX /r” with the number of seconds required, so as soon as the click on the option, Windows is automatically set for a reboot at 2AM, no matter when we push the toast message out to them.

    Again, thanks for all the work you put into this.

    Reply
    • Wow, thank you so much Michael, for taking your time to provide those insights. I appreciate it greatly and it’s feedback like that, which motivates me to do what I’m doing 🙂
      Thanks again.

      Reply
  4. Great this is what I was looking for, directly run the TS from Toast, one step less using PSADT as a bridge.
    This probably may have asked by someone, not sure.
    How about over 1500 machines separated out with 15 days interval deadlines?
    I have over 1500 machines, which I am planning to run on different deadlines due to Pre-Cache, Compat Scan, Maintenance Window, Laptop not available and such. For Dynamic Deadline: does it straight look for > “Package ID” > “Advertisement ID” and the “Deadline for Advertisement ID”. I am sure it does, because only Advertised IDs have the Deadline not the Package ID, but just want to double confirm 🙂

    Reply
    • The package id of the task sequence will populate the deployment deadline into WMI, so if you separate your deployment with several deployments, that’s all good. The script will pickup the individual deadline date dynamically. 🙂

      Reply
      • It got very well smoothly. I can use it for both Application and Package IPU. But now when I deployed the IPU as “Assignment Deadline”, the Software Center Critical window popups on the computer, which I probably won’t over the Toast Notification. The settings are pretty straight forward for the IPU which I got from Garry.

        Reply
  5. Super design !
    Could it be used to trigger the ConfigMgr client to start install the missing patches from Software Center?
    Thanks .

    Reply
  6. Hi Martin. I’m planning on using your script soon to help manage our next wave of in-place upgrade deployments. Since my environment supports a total of 17 different languages, I decided to customize your script so that it would auto-detect the display language on the user’s device, and then automatically display the correct toast notification to the user. If for some reason the user’s display language doesn’t match one of the custom language config files, it will use the default config file when displaying the toast notification.

    I’d love to share more details with you about the changes I made or upload this section of code, in case you (or other users) would find it useful.

    If you’re interested, please just let me know.

    Thanks.

    Reply
    • Absolutely Danny. this sounds like an awesome idea. If you don’t mind, then please share your details and code with me on my email: mab@imab.dk. I will have a look at it asap and include in a future release. Greatly appreciated 🙂

      Reply

Leave a Reply to Martin Bengtsson Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.