Windows 10 Toast Notification Script Update: Second action button and built-in prevention from disabling toast notifications


A new version of the Windows 10 Toast Notification Script is here. The script is now being on version 2.1.0.

This version brings the option to add a second action button to the toast notification (displayed in the illustration below), as well as a built-in functionality to prevent users from disabling toast notifications in Windows 10 altogether.

A second action button is useful in many scenarios. One being with a Windows 10 upgrade, where you, besides the actual upgrade, also have some additional information for the user. In this example, Install Now will launch the actual upgrade, while Learn More will open a specific web page in the browser.

Prevention from disabling toast notifications is stolen with pride from Trevor Jones, and is incorporated into my script. More details down below. ๐Ÿ™‚

Whatโ€™s New

  • 2.1.0 – Added a second action button: ActionButton2
    • This allows you to have 2 separate actions. Example: Action1 starts a task sequence, action2 sends the user to a web page for more info
    • This will require new config.xml files
  • Reworked Get-GivenName function
    • Now looks for given name in 1) local Active Directory 2) with WMI and the ConfigMgr client 3) directly in registry
    • Now checks 3 places for given name, and if no given name found at all, a placeholder will be used
  • Fixed CustomAudioToSpeech option
    • This part haven’t worked for a while it seems
    • Only works properly with en-US language
  • Added Enable-WindowsPushNotifications function // Thank you @ Trevor Jones:
    • This will force enable Windows toast notification for the logged on user, if generally disabled
    • A Windows service will be restarted in the process in the context of the user


The addition of a second action button requires that you update your existing config.xml files. The changes to the config.xml file is highlighted below. In this example, ActionButton1 will restart the computer, and the ActionButton2 will open in the browser.

Prevention of disabling Toast Notifications

As mentioned in the introduction, this is an idea I picked up from Trevor Jones:

If your users are clever enough to disable toast notifications in Windows 10, I think this will be a useful addition to the script.

The setting which the prevention works for, is the one I highlighted below – and only that.

If toast notifications are disabled by the user, the script will try to re-enable them. Entries in the New-ToastNotification.log will indicate when that happens.

More prevention of disabling Toast Notifications?

And while I was brewing on this blog post, Trevor happened to share more nifty stuff on Twitter, as I was concerned for users disabling the notifications per app basis instead.

Usually when a toast notification appear for the user, the user has the option to ‘Turn off all notification” for the source. Turns out, this is something you can prevent as well.

The prevention of disabling toast notification per app basis, is something you do in registry by creating the AppID (Microsoft.SoftwareCenter.DesktopToasts) and create the ‘ShowInSettings’ DWORD value as shown below:


Download everything fromย GitHubย here:ย

If any questions, please leave them down below and I am happy to assist with any issues.


13 thoughts on “Windows 10 Toast Notification Script Update: Second action button and built-in prevention from disabling toast notifications”

  1. Nice update again. I am trying to use the ToastRunApplicationID but when testing it from an administrative PS prompt the action button does not work as expected. I have the RunApplicationID enabled with a value of “ScopeId_3742DF9E-33CE-4271-B69A-9D1B386D93B7/Application_8ca015b9-de30-4f67-a6ac-4cfca084a2d5” and the Action button1 is set to . If I click the button nothing happens. Looking at the ToastRunApplicationID.ps1 script I see it wants to read a value from HKCU, but the RunApplicationID value is not present in that location so nothing happens. What am I missing. I know in the past you had to install a custom script action to get it working, but with that being present it still doesn’t work as expected. The application I am trying to install was made available in Software Center. I also tried running the script in a regular powershell session, but with the same result.

    • The script needs the logged on user’s context. When running the script with RunApplicationID enabled/True and an application id specified, the script will tattoo that into HKCU\Software\ToastNotification, but it will do so in the context the script is run. So don’t run Powershell as a different user, otherwise the registry will be tattooed for a user who does not have the application available in the software center. No additional .msi is required anymore. The script can handle the custom protocols now. Also, pasting the content of the new-toastnotification.log is really useful to me, as I can see if the application is picked up etc.

      • The deployment of the application is set to ‘install for user’. The application is deployed to a collection of users. The deployment was made Available instead of required. The toastnotification is deployed to the same group of users and runs at a schedule.

        The log from the toastnotification script is

        2020-11-19 12:11:24 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
        2020-11-19 12:11:25 INFO: All good. Toast notification was displayed
        2020-11-19 12:15:03 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
        2020-11-19 12:15:03 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
        2020-11-19 12:15:03 INFO: Successfully loaded \\*****\ToastNotification$\config-toast-teams.xml
        2020-11-19 12:15:03 INFO: Loading xml content from \\*****\ToastNotification$\config-toast-teams.xml into variables
        2020-11-19 12:15:03 INFO: MultiLanguageSupport set to True. Current language culture is nl-NL. Checking for language support
        2020-11-19 12:15:03 INFO: Support for the users language culture found, localizing text using nl-NL
        2020-11-19 12:15:03 INFO: Successfully loaded xml content from \\*****\ToastNotification$\config-toast-teams.xml
        2020-11-19 12:15:03 INFO: CreateScriptsAndProtocols set to True. Will allow creation of scripts and protocols
        2020-11-19 12:15:03 INFO: Script version: 2.1.0 matches value of ScriptsAndProtocolsVersion in registry. Not creating custom scripts and protocols
        2020-11-19 12:15:03 INFO: Greeting with given name selected. Replacing HeaderText
        2020-11-19 12:15:03 INFO: Greeting with Goedemiddag
        2020-11-19 12:15:03 INFO: Running Get-GivenName function
        2020-11-19 12:15:04 INFO: Given name retrieved from Active Directory: Daniel
        2020-11-19 12:15:04 INFO: Creating the xml for displaying two action buttons and dismiss button
        2020-11-19 12:15:04 WARNING: This will always enable both action buttons and the dismiss button
        2020-11-19 12:15:04 WARNING: Replacing any previous formatting of the toast xml
        2020-11-19 12:15:04 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
        2020-11-19 12:15:04 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
        2020-11-19 12:15:04 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
        2020-11-19 12:15:04 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
        2020-11-19 12:15:04 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
        2020-11-19 12:15:04 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
        2020-11-19 12:15:04 INFO: All good. Toast notification was displayed

        However… there still is no RunApplicationID in HKCU although the application is visible in Software Center.
        I remember from previous versions that I was able to test the installation of available applications thru the toastnotification script from a PS promt in the VM, but no success yet. I tried it manually in a administrative prompt, which does not work for the reasons given by you. I tried it manually from a regular PS shell, also no luck and I tried it by deploying everything to a User collection and by having the application install for a user, but still no luck. I see the Toastnotification appear for the currently logged on user, but hitting the Install button does not work since the RunApplicationID is not there.

        Anything else I can try?

          • Think I already solved it by myself…. I saw in the PS script that the values from the XML were read into an array and the RunApplicationID was only added if Enabled was “true”. Checked my XML again…. sigh…. there was a value of “True=” instead of “True” so the RunApplicationID was never read into memory.

            Typo with lots of consequences… sorry for the inconvenience. I think it will work now. Better delete the whole comment thread so people can focus on the important stuff ๐Ÿ™‚

  2. Awesome update as usual!

    One thing I did notice when attempting to run the script with PowerShell v7 is that the Create Display-Toast Notification function (starts on line 721) throws a bunch of errors around “InvalidOperation” and the toasts never appear.

    Running the same in version 5.1 works as expected.
    Just wanted to make you aware as this version becomes more prevalent out there, others may see this as well.

    • Thanks John. Seems like the assemblies does not exist in v7.1. It works fine in v7.0 and 5.1 in my end. Keeping an eye out for this.

    • Digging further into this, it seems to be a conscious decision to remove support for Windows Runtime assemblies in PoShv7.1. So there’s that. There’s a workaround, but for now the Toast Notification script caps it support at v7.0 ๐Ÿ™‚

  3. I was wondering, how would i have to deploy the notificatcion script for lets say a TS that installs the 365 apps and how would it come back every time with the toast until the TS is installed?

    • Deploy the task sequence to the devices and make it so, so the user can run the task sequence regardless of assignments (so it’s seen in the software center). Specify the package id of the task sequence in the config.xml in the RunPackageID option, set the action of the action button to ToastRunPackageID: deploy the toast notification script to a collection consisting of devices who’s not yet on the targeted M365 apps. Once the TS has run and upgraded your M365 apps, the devices is no longer in the collection where the toast notification script is running.


Leave a Comment

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