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

Introduction

Another update to the Windows 10 Toast Notification Script is a reality. Now being on version 1.6.

The feedback and questions related to the Windows 10 Toast Notification Script keeps coming and that’s amazing!

In my last post and update of the script, I added the option to natively and with help of a custom protocol in Windows, to run task sequences directly from the action button.

Since then, I was asked if the script is able to launch application directly from the action button as well, and sure thing. I just added that capability to the script and the details are explained below.

What’s New

  •   1.6 – Added new option to run applications (ApplicationID) directly from the toast notification action button. Enable the option <RunApplicationID> in the config.xml
    • Created Display-ToastNotification function
      • Displaying the toast notification as been trimmed and merged into its own function
    • Created Test-NTSystem function
      • Testing if the script is being run as SYSTEM. This is not supported and will prevent the toast notification from being displayed
    • Converted all Get-WMIObject to Get-CimInstance
      • Get-WMIObject has been deprecated and is replaced with Get-CimInstance

Config.xml

The new option, which enables you to run applications directly from the Install/Action button, is highlighted below.

To enable the option, simply configure RunApplicationID to Enabled=”True” and specify the Application ID of the application in the Value field: Value=”ScopeId_A9117680-D054-482B-BC97-532E6CBD0E6B/Application_fd55f35c-4e34-4490-a3ec-ee0b79233ec6″

For your convenience, I have included a new example of the config.xml in the download: config-toast-officeupgrade.xml

Application ID

The ID of an application can be found using Powershell or by browsing the Software Center (and probably with other means too). Both of the options requires that the application in question is deployed to the device.

Powershell

Run below line of Powershell, inserting the name of the application.

The output will be similar to below illustration:

Software Center

The ID of the application can also be found via Software Center by browsing the application in question and using the Share button, also as illustrated below.

Note that it’s only the part after the “=” sign which is needed. Not the entire link.

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 .MSI I provide in the download:

Windows 10 Toast Notification Script Custom Action Protocols.msi

  • Note: This is now coming in a version 1.2.0. If you installed my previous version, you should be able to simply upgrade the installation to include the new files.

ToastRunApplicationID Protocol

The installation currently comes with three custom protocols. The one of interest in this example, is the one called ToastRunApplicationID. The installer creates below registry entries, which creates the custom protocol:

This enables us to use ToastRunApplicationID: as an action in the config.xml, which in return launches the referenced ToastRunApplicationID.cmd.

Local Files

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

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

Run-ApplicationID.ps1

This is the new script doing the magic in this scenario. The script is included in the download, and is being installed onto the device with the installation of Windows 10 Toast Notification Script Custom Action Protocols.msi.

The script is somewhat self explanatory, and is triggering the installation of the application via WMI.

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 ID of the application into HKCU:\SOFTWARE\ToastNotificationScript
  2. When clicking the action/install button of the toast notification, the protocol ToastRunApplicationID: is being initiated
  3. This launches the ToastRunApplicationID.cmd, which again launches the final Powershell script: Run-ApplicationID.ps1
  4. Run-ApplicationID.ps1 dynamically picks up the ApplicationID from the registry and runs the corresponding application 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

Use Case Inspiration

OS Upgrade with Powershell App Deployment Toolkit

So, to keep it short. What I’m doing here, is to have the Install now button directly launching an application based on PSADT. The application based on PSADT, is in return launching the In-Place Upgrade Task Sequence.

The sequence is as following:

  1. Toast Notification pops up
  2. Install now button is launching the application based on PSADT
  3. PSADT is then launching the actual In-Place Upgrade Task Sequence
    1. This via the awesome customization that PSADT provides

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 <<

More info

12 thoughts on “Windows 10 Toast Notification Script Update: Run ConfigMgr applications directly from the action button”

  1. Amazing work, as previously mentioned in earlier version I did some modification and also used that function to trigger application

    Your version 1.6 is more complete and I want to follow your version-control and not mine so will use this when I have the time to deploy it 🙂

    Currently I use several version if your toast on the place I work and this is from production environment right now:

    I have a toast to remind people to update BIOS Firmware update on all our devices. We use Dell hardware

    I also have the last version but modified toast that will notify people about a important application software upgrade – a software from Check Point that is actually “resetting” the network adapter so thats why some custom-made information is required and also let the user decide when they are ready to be disturbed 🙂

    And the next big thing, our InPlace upgrade TS that we going to do from W10 1809 to 1909. No rush with this yet. But I am also using custom made PSADT that will be triggered with your toast.

    Almost forgot! Since Corona we are forced to work from home actually and when that policy applied we had to make sure VPN is working for everyone, so with that I made a reminder about changing password if it will expire within 14 days with your toast. and Alot of people got this toast and changed their password and we avoided hassle with the VPN from users that were frustrated at home when VPN did not work 🙂

    So yea, your work have helped me alot and is widely used where I work, a quite big authority in Sweden 🙂

    Any plans to maybe have this on Github in a public repo?

    //Andreas

    Reply
    • This is awesome Andreas. Thank you for letting me know all of this. Much appreciated. And yes, due to the deprecation of TechNet Gallery, I will move the script into GitHub soon enough 🙂

      Reply
  2. Don’t know if it is already possible, but can you add an action to the action button where if you click it opens your default browser and redirects you to a specific URL set in the XML? Just so we can nag our users to read important messages on the intranet during these special times.

    For now I’ve implemented three different scenario’s of your notification and it works like a charm.

    Reply
        • I would assume that https:yourwebsite.com should work too, but I haven’t tried (seeing this is a protocol based action as well, and should launch the default browser 🙂

          Reply
          • Unfortunately nothing happens and since Edge is not our default browser using Edge as the action first popups a message from Microsoft to set Edge as your default browser or to create a profile. This is not the desired behavior for now.

          • I’m sure you could do something with another custom protocol and even decide very specifically which browser you would open a given link in. What browser is your default? 🙂

Leave a Comment

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