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.


56 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 πŸ™‚

          • Hi Martin,

            I am really enjoying this product and have deployed a few applications in Software Centre using the toast notifications with no issue. I have even removed the Dismiss and Snooze buttons when users have reached a deadline but they are able to click on the X to close the toast popup. Is there a way to prevent them from closing it please?


  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.

      • Perhaps a tip:

        I added this at the testing for prerequirements section of the config-toast-officeupgrade.xml:

        #Check if MS 365 Apps already are installed

        $uninstallKeys = Get-ChildItem -Path “HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”

        $O365 = “Microsoft Office 365”
        $O365Check = $uninstallKeys | Where-Object { $_.GetValue(“DisplayName”) -match $O365 }

        if ($O365Check) {

        Write-Log -Message “365 Apps already installed” -Level Error
        Exit 1

        This way the script will only run if NO 365 apps are installed and can be deployed to all devices and will only run if 365 is NOT installed.

  4. I am trying to deploy through SCCM using legacy package with the user context configuration.
    I notice there is the following error in execmgr.log of the machine “Unable to create account with access to network resources for launch: 80090345” & “failed to run script Powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File New-ToastNotification.ps1 -Config config-toast-osupgrade.xml 0x87d0110a”

    Is there any configuration that I need to look for to avoid this error ?

    • I have never seen that error before. Are doing anything special? The first error translates into: The requested operation cannot be completed. The computer must be trusted for delegation and the current user account must be configured to allow delegation.

      What kind of environment is this? Are you able to run anything in the context of the user? This is not related to the toast script, but something in your environment. πŸ™‚

      • The commandline looks off? cmd.exe /c echo? Where is that coming from? πŸ™‚ I take it that running the script manually outside of configmgr works as the same user? πŸ™‚

        • Win32ErrorCode = 2147942405; – Access denied (FW)
          Firewall rules did not apply on some clients.

          All good, thank you.

          p.s.: can you delete the above post “execmgr log”..


  5. Hi,

    Thank you for the script! It’s super useful and what we’ve been looking for, for years.

    Is it possible to also remove the “Software Center” text in the toast notification?

    It seems like everything is editable, except for that part.


    • Not with the current structure of the notification I’m afraid. Then you would have to redo how the notificication is put together inside the Powershell script. πŸ™‚

    • Hi, I’m afraid I don’t have any fix for that. What version of Windows 10 is that happening on? I’ve never seen it myself and I’ve run the script on several types of devices with different resolutions and scalings πŸ™‚

  6. I am having a problem, the addition of “Shown in action center” for stopping users from disabling the Software center notifications is not working.

  7. Is there a way to completely hide the CMD console (that launch the ps1 script) after it it triggered from the toast message action button?

    • There is, if the powershell scripts are invoked by a .vbs script instead. I initially thought about it, but I didn’t find it on top of my to-do, as an action is taken manually by the user, and something happening on the screen following that action is expected. A short cmd prompt flashing was not too big of an issue in my end to rewrite what I already had written. πŸ™‚

  8. Martin,

    Any suggestions what can be done if we allow only signed scripts in our environment?
    Before I use to replace the scripts after installing custom protocol with signed one, but now when it’s creating them automatically under user profile, it’s not easy. πŸ™

    • Yes, go ahead and disable the option to create customscriptandprotocols, and create and distribute them yourself. πŸ™‚

  9. I will probably need a GPO which will create C:\Users\User\AppData\Roaming\ToastNotificationScript\Scripts folder and copy the files at user login. Do you think this will work or when I will run the toast it will override the files with new one?

    • if you disable the option within the config file: CreateScriptsAndProtocols, nothing will be created or overwritten. This is the way to go if you only allow signed scripts. Create them once on a test computer, sign them and distribute them with whatever method you prefer πŸ™‚

  10. Hi Martin, this script is a life saver, just a quick question though is there anyway to set the pending reboot message specifically for a feature update, for example users have downloaded and installed the update but I want to say “next time you reboot it will take an hour due to feature update install” rather than them expecting a normal windows update reboot. This is just in case we push the monthly security updates down to a device before the user has installed the feature update. Thanks

  11. Hi Martin, thank you for this!

    I have one question, when using the new function with “ToastRunPackageID” connected to ActionButton1 with running the TS directly from the button – is it really necessary to have Software Center open up in a maximized window? the TS is running when clicking the button (so everything works fine) but Software Center also opens, or have I misunderstand something in the config?

    Kind regards,

    • Hey Rasmus, it’s me opening the Software Center on the OSD tab while also executing the TS. This is something I do, I don’t know, to really indicate that something is happening πŸ™‚

      • Thanks for the clarification (and quick answer!)

        Would be a nice feature to be able to disable this, when a user get the toast and click “install now” and the TS kicks off in the background then it’s just an annoying popup for the user – because the TS is already launched and the OSD tab doesn’t contain the “correct” deployment in my case (triggers a TS with Modern Driver Management).

        I could then choose to display the TS progress UI for the user or not and could configure this based on the TS itself, independent of the toast.


        • I get your point. If it bothers you a whole lot, you can change this yourself in the new-toastnofication.ps1 file in the section where the custom scripts are created. Remove this from the custom scripts: if (Test-Path -Path “$env:windir\CCM\ClientUX\SCClient.exe”) { Start-Process -FilePath “$env:windir\CCM\ClientUX\SCClient.exe” -ArgumentList “SoftwareCenter:Page=OSD” -WindowStyle Maximized }

  12. Hi Martin,

    Hope you can help me, I love the toast for 365 apps. I got it working really well. But after upgrading devices to W10 20H2, when clicking install now, the TS doesn’t start but I get a notification you’ll need a new app to open this teastrunapplicationid link, look for an app in the MS store.

  13. After installing W10 20H2 the action button 1 isn’t working. The application or TS isn’t started. Getting the message you’ll need a new app to open this toastrunapplicationid link. I also noticed that the are no scripts created in the folder:


    here the script should be created when the notification script is started right? like the toastrunapplicationid.ps1? But if this script isn’t created i guess the action button fails?

  14. Hi Martin,

    I found the issue, when clicking the action button to start a task sequense the wrong ps1 is run it’s running the toastrunapplictaionId.ps1, but it is a package i want to be run (task sequence) not an application.

    When i manually run the ToastRunPackageID.ps1 the task sequence is started from software center.

    • The custom scripts and protocols is created if the option in the config.xml is enabled. The scripts are created in appdata\toastnoficationscript\scripts. If this folder is empty, the option to create the script is either not enabled or something/someone has deleted them. The scripts and protocols is only created if the registry entry in registry (Computer\HKEY_CURRENT_USER\SOFTWARE\ToastNotificationScript) does not exist or does not match the script version.

      If you want to run a task sequence, the action button should be configured to: ToastRunPackageID: This will call the relevant .ps1 script (ToastRunPackageID.ps1) and launch the specified task sequence (package id of the task sequence)

  15. Martin,

    Every time I try to run the script in SCCM as a package I get Exit Code 4 (0x4). It seems the script is constantly trying to run as the System account instead of the currently logged in user. Outside of SCCM, when I run the script as the system account I get the following error: “Write-Log : The script is being run as SYSTEM. This is not supported. The script needs the current user’s context
    At \\UNC\PATH\ToastNotification\New-ToastNotification.ps1:759 char:9”

    I ran and tested the script under the user account and it works fine but when I run it in SCCM, it keeps failing.

    Do you have any ideas, this really has me scratching my head.


    • On the environment tab of your program, you need to make sure to select Run with user’s rights and Only when a user is logged on πŸ™‚

  16. Hi Martin
    Been using your toastnotification for a long time and it is awesome πŸ™‚
    Regarding what Rasmus’ have asked, I’m having this issue.
    When I try to run a package with “RunPackageID” it all works πŸ™‚ , but it open software center maximized and on the Operating Systems pane?
    It is probably because you make and use ToastRunPackageID.ps1 for both packages and TS? Maybe you could make another custom protocol, so we have one for TS and another for packages? And then we can edit in New-toastnotification.ps1 before creation of the scripts on the clients, regarding windows size and software center pane?
    Does it make any sense?

    • Yeah, it’s on purpose I open the software center. I can see how that’s weird if used with something else than a task sequence. Let me add that to my notes πŸ™‚

      Thank you.

  17. Hi Martin, Thanks for sharing your script, its brilliant and saves me a lot of problems.

    I have a question regarding OS upgrade deployments.

    I’m currently upgrading Windows 10 1809 to 20H2 using a ConfigMgr 2103 task sequence deployment.

    I have deployed your toast notification script (v2.2.0) and endpoints are receiving upgrade notifications.

    However, in your example screenshots, you have a deadline set. I am wondering how you set your deadline as I thought you cannot set a deadline for a task sequence advertisement.

    Are these screenshots using Windows 10 servicing?

  18. Hello Martin,

    I am just starting to use your amazing toast notification script and I cant get it working. All it does is display a plain toast notification. The header text is “Windows Powershell” and the body text is “New Notification” with the powershell logo as the logo image. I have not made any changes to the code only the XML configuration file. What might be causing the notification to appear blank?

    Thank You

  19. The Script is just amazing πŸ™‚
    For some reason even after creating Computer\HKEY_CLASSES_ROOT\AppUserModelId\Microsoft.SoftwareCenter.DesktopToasts and showinsettings -0 I still have the option to disable the notification.
    What might be the cause of it.

  20. Thank you for the post.

    I tried to use your script in my environment and I could see that users can turn off the notification from powershell. If they do that, the script doesnt show notification anymore. We are not using SCCM and only have intune tenant. The key that you posted may work for Software center SCCM but do you have any sugggestions for those who only have Intune. I tried to see if there is registry key regarding powershell to prevent users from doing it but I couldn’t find any. if you have any leads on this, it would be helpful.

  21. Hi Martin,

    Thank you so much for your work – it is an amazing tool. I have used it for deploying a few pieces of software and it works beautifully.

    My only issue is that users can close the toast by clicking on the x button next to where it says ” Software Center”. I have been able to remove the Snooze and Dismiss buttons so it only gives them the option to “Update now”, but they can still dismiss the toast simply clicking on x. Is there a way to remove the x?

    Many thanks,



Leave a Comment

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