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://github.com/imabdk/Toast-Notification-Script <<

61 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
  7. Hey, great tool i am using it for Pending reboots and Password Expiry already! I am now looking to use it for IPU to Windows 10 1909. I am having some trouble however. I can see it running the toast fine, but when i click install nothing happens.

    On the toast i can see it pulling through the installation deadline ok, with in software centre the task sequence gives the options to install or schedule.

    I can see a black window flashing up after i click install.

    Is there anything you can think of which might be missing?

    Reply
  8. Hi,

    First of all thanks for this great tool, but I have a little issue and i don’t understand what I’m doing wrong. I get the toast working prompting for OS Upgrade … but if I click “Upgrade Now” I get a message that is requesting an App to open it … it seems that tha action button doesn’t now how to handle the action. The toast notification script is installed. I see all the content in c:\ProgramData and if I run manuallly from there de CMD file the PS1 file starts and the task sequence starts … So the problem is from the action button …

    Any advice ?

    Thanks a lot

    Reply
    • This would usually indicate that the protocol used in the action is not present in the OS. From the top of my head, this should be ToastRunPackageID: If the protocol exists in the OS, you should be able to run this directly from Run in Windows as well. This is not a default protocol that exists. Did you create the custom protocol yourself or did you install my .MSI? 🙂

      Reply
  9. Hi Martin,

    The first thing to say is a big Thanks for all the hard work you have put into this whole Toast notification project that really impressed me and would make my life easier If I get the point to make it work properly.
    I want to share with you and the rest of the community here to see if you guys can give light to the end of the tunnel to me.I really love the job you’ve done and I’ll love to have in place in my environment for my InPlace Upgrade project from previous Windows 10 Releases to Windows 10 2004.I’m dealing with some problem to get it running properly and now I feel completely lost and I’m wondering if you guys can take a look and please give me advise where to go from here.

    Objective: Deploy an In-Place Upgrade Task Sequence for Windows 10 2004Environment: SCCM v2002——————————————————————————————-
    1. This is the my config-toast.xml——————————————————————————————–



















     









            Your computer is required to restart due to having exceeded the maximum allowed uptime.
            Reason: Pending reboots was found in registry or WMI.
            Your password will expire on:
            Your computer needs to restart. Please Do it now.
            Install Now  
            Dismiss
            Snooze
            https://www.aaa.com
            ISS Service Desk kindly reminds you…
            Windows 10 upgrade available!
            While upgrading, your computer must remain plugged in, powered on, and connected to a network. This upgrade will take 1-2 hours, during which your device will be unresponsive, and will re-boot several times. Your data will not be impacted.
            Select ‘Install Now’ below, to upgrade now – you will see a second dialog box and should click ‘Yes’ to begin the upgrade. You may also pick ‘Snooze’ or ‘Dismiss’ below, to delay your upgrade –  but only temporarily. On/after your Deadline (shown above), the upgrade will begin automatically.
            Click Snooze to be reminded again in:
            Your deadline is:
            Good morning
            Good afternoon
            Good evening
            Minutes
            Hour
            Hours
            Computer uptime:
            days
       
    Some more language lines omited…————————————————————————————————————
    2. I’m creating a package with these properties:
    Package Content:Custom Protocols (folder from original files v1.8.0)Images (folder with my logos)Hidden.vbsNew-ToastNotification.ps1RunToastHidden.cmdAnd I’m creating the program using the suggested line in the documentation:powershell.exe-ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden-File .\New-ToastNotification.ps1 -Config “\\MyUNCPath\ToastNotificationScript\Configs\config-toast.xml”I have the config-toast.xml in a folder out of the package to make easy any change on it as suggested in the doc.Run: HiddenProgram can run: Only when a user is logged onRun mode: Run with user’s rightsDrive mode: Runs with UNC name3. I’m checking that Software Center it’s fully working.
    4. Installed the “Windows 10 Toast Notification Script Custom Action Protocols.msi” as I pretend to deploy an InPlace Upgrade Task and according to the blogs here.5. Deployed the IPU Task to the collection where is locate the PC with these properties:RequiredChecked – Schedule when this deployment will become available: the same deployment day and time.Assignment schedule: Creating here one day after a deadline for testing.Rerun if failed previous attempt.Unchecked – Show Task Sequence progress.Download all content locally before starting task sequence.6. I’m giving time to the IPU TS to be deployed in the PC before deploying the Package Program.7. I’m deploying the Package Program with these properties:Required
    Checked – Schedule when this deployment will become available: the same deployment day and time.Assignment schedule: Creating here a schedule to run every 10 mins for testing.Always rerun programUnchecked – Show Task Sequence progress.Download content from distribution point and run locally (also tried the other option – run from DP)
    Results I’m getting:—————————————————————————–1. New-ToastNotification.log
    2020-08-05 16:14:11 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
    2020-08-05 16:14:11 INFO: The registry key for determining if toast notifications are enabled does not exist. The script will run, but toasts might not be displayed
    2020-08-05 16:14:11 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
    2020-08-05 16:14:11 INFO: Successfully loaded \\Inter-sc\osd\Settings\WaaS\Tools\ToastNotificationScript1.8.0_2004_Config\config-toast.xml
    2020-08-05 16:14:11 INFO: Loading xml content from \\Inter-sc\osd\Settings\WaaS\Tools\ToastNotificationScript1.8.0_2004_Config\config-toast.xml into variables
    2020-08-05 16:14:12 INFO: Successfully loaded xml content from \\Inter-sc\osd\Settings\WaaS\Tools\ToastNotificationScript1.8.0_2004_Config\config-toast.xml
    2020-08-05 16:14:12 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
    2020-08-05 16:14:12 INFO: Running Write-PackageIDRegistry function
    2020-08-05 16:14:12 WARNING: PackageID: P0100018 was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr
    2020-08-05 16:14:12 INFO: DynDeadlineEnabled set to True. Overriding deadline details using date and time from WMI
    2020-08-05 16:14:12 INFO: Running Get-DynamicDeadline function. Trying to get deadline details from WMI and ConfigMgr
    2020-08-05 16:14:12 INFO: Appears that the specified package ID: P0100018 is not deployed to the device.
    2020-08-05 16:14:12 INFO: Greeting with given name selected. Replacing HeaderText
    2020-08-05 16:14:12 INFO: Running Get-GivenName function
    2020-08-05 16:14:13 INFO: Given name retrieved from Active Directory
    2020-08-05 16:14:13 INFO: Creating the xml for displaying both action button and dismiss button
    2020-08-05 16:14:13 INFO: Creating the xml for snooze button
    2020-08-05 16:14:13 INFO: Toast notification is used in regards to OS upgrade. Taking running OS build into account
    2020-08-05 16:14:13 INFO: All good. Toast notification was displayed———————————
    2. There is not any Package ID under HKCU:\SOFTWARE\ToastNotificationScript3. I think as a consequence of that fact, the Action (Install Now) is not starting any TS.4. Eventually, I get the Toast Notification once and then disappears and the second test, only one black Notification from Software Center appears on the ToastNotification as schedule bat black.5. The DeadLine does not appears anyway.6. The last test I did was Run manually the script New-ToastNotification.ps1 with all the content locally in the PS Console to see any error and the result was:Toast notification start showing with the proper image and text but not the DeadLineAction (Install Now) doesn’t call the TS and to run.Apparently running every 10 mins as defined in the previous SCCM package deployment schedule.

    Reply
  10. HI there great script, I have another question, I am using this for an IPU with SCCM1910 and when I add the TS packageid its errors with cant find that packageid deployed to the computer, so I changed as a test to the package id of the actual win10 upgrdade package within the deployed TS and it find that and outputs good the popup to upgrade or dismiss as I set, is it possibly the deployment setting of the task sequence?, hope you answer.. Cheers

    Reply
    • Hi, yes, make sure that the task sequence is available in the Software Center in the Operating Systems tab. If the task sequence is deployed as required, you need to to tick ON ‘Allow users to run the program independently of assignments’. Let me know how it works out for you 🙂

      Reply
      • Hey Martin, cheers for quick reply. I will try what you said tomorrow morning at work, makes sense though :), I precache the TS out first and then only want end users to see the popup and only when they’re ready run it, so perfect thanks for the scripts etc. I’ll let you know how it goes, trying also to hide the TS in sw centre from the users 🙂

        Reply
      • Hey Martin, just to let you know worked a treat allowing users to run program independent of assignments :), runs upgrade TS perfect yer the man cheers again and hope yer good n keeping safe, 🙂

        Reply
  11. Hi again, was wondering if you came across the packageid not been seen when running the ipu ts to a home user on WiFi and da. The same ipu ts and toast config run no problem when a device is targeted which is cabled on domain. Trying everything but can’t seem to get the packageid to be found when running the toast ps command. Says can’t find it, like I’m your error description.. Hope you can advice some, it’s running good when cabled desktop is targeted but not home laptop user on DA. Thnaks if you can advice me any. Robert

    Reply
  12. isn’t the Windows 10 Toast Notification Script Custom Action Protocols.msi not needed anymore for the run TS directly from the action button. I don’t see the msi in the download.

    Reply
  13. Hi all,
    i have a problem using the Toas Notification Script.

    I want to show Notifications when Updtes are available.

    1) i Deploy my Software Update Group
    2) i search for the PackageID via Powershell in SCCM
    There is no PackageID on my deployment.
    On SCCM Graphical Side there is one i took that one and get error in the Logs.
    ###PackageID: AMP00187 was not found in WMI as deployed to the client.

    any advice
    Thanks.

    Reply
    • Make sure the software updates are visible in SC even with a require deployment. Make sure it’s visible by configuring allow running this deployment regardless of assignments

      Reply
      • EDIT: Make sure the TS is visible in the OSD tab regardless of required or available. This is needed via the option I mention (allow running this deployment regardless of assignments), Otherwise I cannot find it via WMi and Powershell

        Reply
        • Thanks for you fast response Martin,

          Software Updates are visible i can install them and show them via Notification when i go with the : config.xml
          But when it comes for action through ( Action1 Value=”ToastRunUpdateid:” ( i must enter all the KB of the Deployed SUG – and some updates have no KB number –

          ( i spoke now only for updates, no task sequences (upgrades) )

          i found an way to install them but it needs an indivuduall script
          which i post here:

          ##### it captures all available updates in sccm
          $TargetedUpdates= Get-WmiObject -Namespace root\CCM\ClientSDK -Class CCM_SoftwareUpdate -Filter ComplianceState=0
          ##### it install them
          Invoke-WmiMethod -Class CCM_SoftwareUpdatesManager -Name InstallUpdates -ArgumentList (,$MissingUpdatesReformatted) -Namespace root\ccm\clientsdk
          “$system,Targeted Patches :$approvedUpdates,Pending patches:$pendingpatches,Reboot Pending patches :$rebootpending,initiated $pendingpatches patches for install” | Out-File $log -append

          * it would be nice if you can document how someone cann add in an easy way costum scripts

          Thank you – hope i can find a way that this can run – all in all its a perfect solution
          Regards, Nehat “Alias John”

          Reply
          • # config.xml
            RunUpdateID “*”
            Action ToastRunUpdateID: i must enter all kb here …
            This is what i mean with config.xml

  14. Quick Question, This script is great!!

    Whats the best way to deploy the script via SCCM?

    Also how does the dismiss button work? Will it eventually pop back up.

    Reply
    • Dismiss will dismiss the notification. it will not be coming back unless you schedule another run. use a package/program in configmgr 🙂

      Reply
      • Thanks Martin, last issue ive got now is that when its deployed to the user its unable to see that the task sequence package is deployed to the machine even though it is, This is down to user access rights, is there anyway to get around this?

        Reply
        • Is the TS displaying in the Software Center? in order for the script to be able to pick it up via WMI, is has to be visible for the user in the Software Center. if this is a required TS, you will need to enable the user to run the TS regardless of assignments. Thats an option somewhere in the deployment of the TS 🙂

          Reply
          • It is yes, the WMI is seen if an admin is logged on but not the standard user which the script errors out because the standard user cant see the output of the WMI its just blank

          • It is in the software centre yes. If an admin is logged on the script works and toast loads as expected but if a standard user is logged on to the same device it errors out at the WMI package check

          • I don’t understand. The TS set to available and the package as required? Are you talking about 2 separate deployments?

  15. Hello,
    Nice blog , but I am wondering where are the files for run-packageid.ps1 and ToastRunPackageID.cmd? I cannot find it on github now.
    I want to use this Toast notification in my IPU for upgrading from 1909 to 20H2.

    Reply
  16. Hi Martin

    Thanks for the great script, i put this to the test today deploying a Task Sequence to my own device and a few other devices. My own device when i clicked the Upgrade Now button deployed perfect, i could see it launched the task sequence and it did everything as expected. The other devices when i clicked the Upgrade Now button i could see the command prompt window open for a brief moment and then nothing happened.

    My first thought was maybe because I have local admin rights on my device, and the other devices do not have local admin rights. I can see that the Windows 10 Toast Notification Script Custom Action Protocols are installed on all the devices. Is there something in particular i need to be checking?

    Reply
  17. Martin
    Thanks so much for your blog and script. My toast is working properly to TS on the action button BUT when Software Center launches it opens to the Operating System tab. How do I make it open to the ‘Application’ tab instead?
    Action button is configured for PackageID

    Again, action button is working as it launches the TS pkg successfully with no issues but SC opens to ‘Operating System’ section instead of the ‘Application’ section where the TS pkg and other apps are listed. Any help is appreciated. Thank you.

    Reply
  18. Is there no way of instead taking the user to the Operating Systems tab rather than immediately starting the task sequence with the Action buttons?

    Reply

Leave a Comment

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