Windows 11 Toast Notification Script

Description

The Windows 11 Toast Notification Script enables you to create nice and nifty toast notifications for the logged on user in Windows 10/11. This can be done with Configuration Manager, Microsoft Intune and scheduled tasks.

The script comes with 3 main purposes/features, but is not limited to:

  • UpgradeOS
  • PendingReboot
  • ADPasswordExpiration

UpgradeOS is meant to be used with Windows Servicing, notifying users about new available Windows versions. This is primarily intended to be used with ConfigMgr. The main idea here is to lure the end-users into a voluntary participation and make them initiate the in-place upgrade themselves. This works for both task sequences and feature updates.

The toast notification displayed for the end-user in such scenario, may look similar to below mid example, where the Install button will redirect the user into the Software Center:

PendingReboot is the second purpose/feature and is displayed above to the right. The idea here is to increase compliance and overall stability of the running computers by reminding users of pending reboots. Pending reboot here is checked in the registry and WMI.

PendingReboot is also capable of considering the uptime of the computer. When the uptime exceeds the value defined in the config.xml, the toast is displayed reminding users to restart more often.

ADPasswordExpiration is the third feature checking for local active directory password expiration. If the password is about to expire (days configured in config.xml), the toast notification will display reminding the users to change their password.

Configuration

The entire toast notification is configurable through the config-toast.xml. The idea here is, that the purpose of the toast notification can be modified without the need to push new files and/or update distribution points in ConfigMgr.

I have included several configuration samples in the download; one for use with Windows Servicing, one for checking for pending reboot, one for AD password expiration and another for upgrading Office.

Images

The images are changeable. Just replace ToastHeroImage.jpg and ToastLogoImage.jpg with your own. Some of the images I’m using throughout my posts is paid pictures and protected by copyright.

Logging

ConfigMgr admins loves log files! The script logs all its actions to AppData\Roaming\ToastNotificationScript\New-ToastNotification.log. This is useful when troubleshooting or if curious of what is done. Also, there are some combinations in the config-toast.xml which doesn’t makes sense and thus these are prevented. The log will tell when that happens.

Running the Script

How you run the script is mentioned in details in the documentation.  In short, this is simply done using Powershell. Here’s a few examples:

  • .\New-ToastNotification.ps1 -Config .\config-toast-osupgrade.xml
  • .\New-ToastNotification.ps1 -Config .\config-toast-adpwexpiration.xml
  • .\New-ToastNotification.ps1 -Config “\\Server\Share\config-toast-rebootpending.xml”
  • .\New-ToastNotification.ps1 -Config “https://krpublicfiles.blob.core.windows.net/toastnotification/config-toast-whfb.xml”
  • .\New-ToastNotification.ps1 (running it without parameter will default into -Config .\config-toast-xml)

Documentation

I have included a first draft of the documentation in the download.

Version history

  • 1.0 – Script created
  • 1.1 – Separated checks for pending reboot in registry/WMI from OS uptime
  • 1.1 – More checks for conflicting options in config.xml
  • 1.1 – The content of the config.xml is now imported with UTF-8 encoding enabling danish, german etc. characters to be used in the text boxes
  • 1.2 – Added option for personal greeting using given name retreived from Active Directory. If no AD available, the script will use a placeholder
  • 1.2 – Added ToastReboot protocol example, enabling the toast to carry out a potential reboot
  • 1.3 – All text elements in the toast notification is now customizeable through the config.xml
    • Expanded the options for finding given name. Now also looking in WMI if no local AD is available
    • Added Get-WindowsVersion function: Testing for supported Windows version
    • Added Test-WindowsPushNotificationsEnabled function: Testing for OS toast blockers
    • Added contributions from @SuneThomsenDK @ https://www.osdsune.com
      • Date formatting in deadline group
      • Fixed a few script errors
      • More text options
  • 1.4 – Added new feature for checking for local active directory password expiration
    • If the password is about to expire (days configured in config.xml), the toast notification will display reminding the users to change their password.
      • Using this feature requires the ActiveDirectory powershell module
      • The function will try to import the AD powershell module, look up the user’s SamAccountName and use that with the Get-ADUser cmdlet
  • 1.4.1 – Get-ADPasswordExpiration function modified to not requiring the AD Powershell module. Thank you @ Andrew Wells
    • Improved logging for when no toast notifications are displayed
  • 1.4.2 – Bug fixes to the date formatting of ADPasswordExpiration now correctly supporting different cultures
  • 1.4.3 – Some minor corrections to the Get-GivenName function when retreiving first name from WMI and registry
    • Moved the default location for New-ToastNotification.log file to the user’s profile (to cater for permissions issues in %programdata%)
    • Added contribution from @kevmjohnston @ https://ccmcache.wordpress.com
      • Added function for retrieving deadline date and time dynamically in WMI with ConfigMgr
  • 1.4.4 – Fixed DynamicDeadline option and conversion to UniversalTime to display the deadline time correctly regardless of timezone
  •   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
  •   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
  • 1.7 – Added multi language support. Thank you Matt Benninge @matbg
    • Script and config files now supports multiple languages
      • Note that old config xml files needs to be updated to support this
    • Moved text values in config files from option to the text-section for consistency
  • 1.7.1 – Added 2 new options (LogoImageName and HeroImageName) to the config file, allowing switching of images more easily and dynamically
  • 1.8.0 – Added support for using Windows 10 Toast Notification Script with Endpoint Analytics Proactive Remediation
    • Added support for having config.xml file hosted online
    • Added support for having images used in the script hosted online
  • 2.0.0 – Huge changes to how this script handles custom protocols. Huge thank you to Chad Brower
    • Added Support for Custom Actions/Protocols within the script under user context removing the need for that to be run under SYSTEM/ADMIN
      • <Option Name=”Action” Value=”ToastRunUpdateID:” />
      • <Option Name=”Action” Value=”ToastRunPackageID:” />
      • <Option Name=”Action” Value=”ToastRunApplicationID:” />
      • <Option Name=”Action” Value=”ToastReboot:” />
    • Added Support to dynamically create Custom Action Scripts to support Custom Protocols
    • Added Support for Software (Feature) Updates : Searches for an update and will store in variable
    • Added new XML Types for Software Updates:
      • <Option Name=”RunUpdateID” Enabled=”True” Value=”3012973″ />
      • <Option Name=”RunUpdateTitle” Enabled=”True” Value=”Version 1909″ />
    • Added support for getting deadline date/time dynamically for software updates
      • Configure DynamicDeadline with the UpdateID
  • 2.0.1 – Updated custom action scripts!
    • Moved all custom action scripts into the user’s profile in $env:APPDATA\ToastNotificationScript
      • $env:ALLUSERSPROFILE was used previously. This is a bad location if device is used by multiple users due to permission issues
    • Updated all custom action scripts to invoke their respective action via WMI
      • Rewritten all custom action scripts
    • Added logic allowing new custom action scripts to be created if necessary
      • Now checks script version in registry
      • If newer version is available from the script, new custom action scripts will be created
        • This allows me to make sure the relevant scripts are in place in case I change something along the way
    • Modified script output of custom script for RunPackageID to pick up Program ID dynamically
  • Added support for getting deadline date/time dynamically for applications
    • Configure DynamicDeadline with the Application ID
  • 2.0.2 – Fixed an error in the custom protocols
    • The path to the custom scripts was incomplete
  • 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: https://smsagent.blog/2020/11/12/prevent-users-from-disabling-toast-notifications-can-it-be-done/
    • 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
  • 2.3.0 – Added the Register-CustomNotificationApp function
    • This function retrieves the value of the CustomNotificationApp option from the config.xml
    • The function then uses this name, to create a custom app for doing the notification.
      • This will reflect in the shown toast notification, instead of Software Center or PowerShell
      • This also creates the custom notifcation app with a prevention from disabling the toast notifications via the UI

Troubleshooting Tips

  • The script needs to run in the current user’s context. Don’t run Powershell as another user and expect the toast notification to show. That goes for when running the toast with ConfigMgr as well. It needs the user’s context to display the toast notification for the logged on user.
  • There are combinations in the configuration which doesn’t make sense and I’m preventing most of them. The best advice here is to look on the included configuration examples and stick to those if things are not working.
  • The toast notification has a limit on the sheer size of content. That includes text elements and buttons. You can hit a combination where you have too much text in combination with the snooze option, and you will start seeing the toast rendering without buttons.
  • ConfigMgr admins love log files! Paste the log file as a comment with a few words of your issue, and I can most likely give you the reason for your troubles.
  • Smile 🙂

Download

https://github.com/imabdk/Toast-Notification-Script

Previous Blog Posts

The documentation on the script is currently lacking information. Instead, I suggest you read through some of my previous blog posts, as they are explaining in details, what each new version and capability is offering:

889 thoughts on “Windows 11 Toast Notification Script”

  1. Hi,

    that is a great feature, but how often check the script the uptime and show the message?
    And where can i configute the interwall?

    Best regards
    Robert

    Reply
    • You decide how often the script runs by running it on a set schedule. That goes for both running with Configmgr and/or scheduled tasks 🙂

      Reply
    • Can you please answer below points.

      a)How this will be deployed?
      (b) When this will be deployed?
      (c) Frequency of the deployments?
      (d) What are the criteria (or) categorized considered to identify machines?
      (e) How the success & failures will be measured?
      (f) what is the Low Level Design construct or PS Script and other deliverables?

      Reply
  2. Hi,
    in your previous version the scandinavian alphabets (å ä and ö) were working OK.
    In this version they render wrong.
    Could this be fixed?

    Thanks for your great work!

    Reply
    • Hey, great input. I actually never tested that even though I’m from Denmark myself. Let me look into that and get back to you 🙂 I assume it’s due to the text is now set externally in the xml.

      Reply
  3. What could cause the error for displaying the Notification?

    2019-03-14 11:34:10 INFO: No HeroImage file set as parameter. Using local image file
    2019-03-14 11:34:10 INFO: No LogoImage file set as parameter. Using local image file
    2019-03-14 11:34:10 INFO: Successfully loaded \\sccm04-vm\sources$\Packages\Software\ToastNotificationScript\config-toast-rebootpending.xml
    2019-03-14 11:34:10 INFO: Loading xml content from \\sccm04-vm\sources$\Packages\Software\ToastNotificationScript\config-toast-rebootpending.xml into variables
    2019-03-14 11:34:10 INFO: Successfully loaded xml content from \\sccm04-vm\sources$\Packages\Software\ToastNotificationScript\config-toast-rebootpending.xml
    2019-03-14 11:34:10 INFO: PendingRebootCheck set to True. Checking for pending reboots
    2019-03-14 11:34:10 INFO: Running Test-PendingRebootRegistry function
    2019-03-14 11:34:10 INFO: Check returned FALSE on ANY of the registry checks: Reboot is not pending!
    2019-03-14 11:34:10 INFO: Running Test-PendingRebootWMI function
    2019-03-14 11:34:10 INFO: Computer has SCCM client installed – checking for pending reboots in WMI
    2019-03-14 11:34:10 INFO: Check returned false on checking WMI for pending reboot: Reboot is not pending!
    2019-03-14 11:34:10 INFO: Creating the xml for displaying both action button and dismiss button
    2019-03-14 11:34:10 INFO: Toast notification is used in regards to pending reboot. Uptime count is greater than -3
    2019-03-14 11:34:11 INFO: All good. Displaying the toast notification
    2019-03-14 11:34:11 INFO: Something went wrong when displaying the toast notification

    Reply
    • Are you running the toast as another user than the user logged on? 🙂 The toast only runs in the context of the user being logged on as it obviously needs to be interactive and display to the user. If you are running this with SCCM, you need to make sure your program runs in the users context 🙂

      Reply
  4. Hi again.
    Can you explain the MaxUptimeDays Value? What means the value “-3”?
    And
    Can you fix the script for German language (äöüß)?

    Thanks

    Reply
    • That was just me testing, going back in time. My computer was just restarted when I did that part, so I had to go back in time with a negative value. MaxUptimeDays is the maximum days a device is allowed to not have rebooted and thus displays the toast.

      Reply
    • I’m afraid that’s not possible. A limitation in the API itself and is limited due to protecting the OS 🙂

      Reply
  5. Would it be possible to start a OS upgrade task sequence directly instead of opening the software center application only?

    Reply
    • You have the option to use softwarecenter:Page=OSD to open Software Center directly into the OS page. Not exactly what you are desiring, but close. 🙂

      Reply
  6. First off all thanks for the solution

    Fix ÆØÅ:
    To support other ÆØÅ change line 168 – Think it work with german char to but havent testet
    $Xml = [xml](Get-Content -Path $Config)
    to this
    $Xml = [xml](Get-Content -Path $Config -Encoding UTF8)

    We needed something like this for our environment but we still stuck with Windows 7 so i created a “form” to serve that side too.

    Windows 7 Reboot Notification Form
    Posted i here https://gallery.technet.microsoft.com/Windows-7-Reboot-23a8377d

    Longquo/DK

    Reply
  7. Thank you for this great feature!

    Is it possible to use the Toast Notifications for normal Windows Updates?
    Would be amazing, users could defer the updates for some time.

    Reply
    • Hey, I attach two images in the download. Take a look at the the sizes of those and you have a good idea. 🙂

      Reply
  8. Hello, I am trying to use toast notification to prompt users to install software from Software Center. I would like to give users the option to click on a button to go to a website to get more information about the software that is required to install. I have been able to create the new button but struggling to get the website to open either through Internet Explorer or Edge. Do you know if this can be done and if so, how can I accomplish this?

    Reply
    • There’s nothing built into the script which would do the translation. All of the text comes from the config.xml for you to customize yourself 🙂

      Reply
  9. Thanks for the scandinavian alphabet support. Working just nicely!

    One question, can the image (heroimage, the bigger one) size vertically be altered anyway if the horizontal size stays the same.
    I mean so that the toast wont stretch it automatically to 180 pixels vertically if the image is something like 340×100.

    Reply
  10. Hi Martin,

    Nice work, however, I was attempting to show others this script, however, I attempted to run on Windows 10 1809 (OS Build 17763.379). It seemed to process, but did not display the notification. Thoughts?

    Reply
    • Hey, what does the log file in programdata\toastnotificationscript say? How are you running the script? Manually? How’s your execution policy configured? 🙂

      Reply
  11. False alarm. Was just me testing the “TargetOS” option in the XML. LOL. ;-). It works and will not show the toast notification if the running OS and target OS are the same.

    Reply
  12. Hey Martin
    First: Thank you for that great idea and all the provided work!

    I`m now wondering if it is possible to start a powershell script when hitting the “install” button.

    Reply
    • Hello Ralf, I’m afraid that’s not possible due to restrictions in the OS. It’s prevented due to security reasons 🙂

      Reply
  13. Hey, thanks for a very cool solution.

    Just a headsup for other users, if you are not using SCCM, make sure to change config file to use PowershellApp instead of SoftwareCenterApp, or else you are not seeing any notifications 🙂 SoftwareCenterApp is not a default Windows 10 app, but comes as part of SCCM.

    Reply
  14. Hello, first off thanks for your work and sharing this. I believe I have it almost up and running but I’m running into a slight problem. I only get a pop up saying “New Notification” using either PowerShell or SCCM. We do have SCCM installed so would prefer to go that route. I’m not seeing the pop up of the images above do you know where I’m going wrong? Thanks.

    Reply
    • Hey, does it work when run out-of-the box directly after download without doing any changes to images and the config? Does the log say anything useful? (programdata\toastnotificationscript\new-toastnotification.log)

      Reply
        • Hey Nathan, there must be some sort of configuration in your OS preventing toast notifications. There are few which can do that. I’m very curious to know the ups and downs. I’m planning to add some sort of check for blockers, those that I know of making it more clear what’s going on.

          Reply
          • I am experiencing the same issue, I am still only at the stage of testing the script by running it manually.

            I have run the script using Powershell and Software Center Toast, and have tried running it OOTB on both Windows 10 1703 and Windows 10 1903.

          • I am experiencing this same issue. It works fine out of the box. Issue seems to be when run as part of a program and from a distribution point or from a network share.

          • Don’t run it from a UNC path or directly from DP (which also translates into a UNC path). The XML layout in the toast will break if doing so. Create a package, which downloads the binaries into the CMcache. The config.xml can be located on a network share, UNC path etc., but not the script itself.

          • Martin, thank you for confirming. Might I suggest pointing this out in the SCCM Installation section of your documentation so other may not run into the same issue. Great tool and I am looking forward to using it in my environment.

  15. Hi Martin, Thank you!!! it is very helpful ?

    is it possible to assign tag and group for toast notifications via PowerShell? And is it possible to clear the notifications from ActionCenter conditionally using tag and group?

    Reply
      • Hi Martin,

        We want to show toast message to inform the users to reboot the Windows 10 machine.

        Scenario:
        1. Toast message is shown to the user requesting to reboot the machine.
        2. User is moving the toast message to Action Center.
        3. After some time, user is rebooting the machine.

        But, the toast message exists in Action Center. I want to remove the toast message conditionally from Action Center , when user login again. To my knowledge, this can be achieved by assigning tag to the toast message. Later toast message can be removed from Action Center using PowerShell by referring the tag, but I do not know the PowerShell code to use.

        Thanks,
        Thangaselvam

        Reply
        • Hi Thangaselvam,
          Great question. Thing is that I actually don’t know 🙂 Sounds like something I need to study further.

          Reply
          • I came across this same need recently and found that if the notification is constructed differently, tag and group can be added, so that they can be used to remove the notification later. (Hopefully the code below displays okay.)

            In the Display-ToastNotification function, comment out the line:
            [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($App).Show($ToastXml)

            … and add:
            $Load = [Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime]
            $Notification = [Windows.UI.Notifications.ToastNotification]($ToastXml)
            $Notification.Group = “your-group”
            $Notification.Tag = “your-tag”
            [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($App).Show($Notification)

            Then, you can remove the notification later with:
            $toastNotifierHistory = [Windows.UI.Notifications.ToastNotificationManager]::History
            $toastNotifierHistory.Remove(“your-tag”, “your-group”, $App)

            Hope that helps someone, and thanks Martin for this amazing work.

    • Hey, if you have the Snooze button enabled, that will always include both action button AND dismiss button. You can modify the Powershell script if this is something you don’t want, but currently it’s restricted like this 🙂

      Reply
        • Hi Alvaro, would you be able to share how you were able to hide the dismiss button only?
          Not an expert at scripting at all 🙂

          Reply
          • No scripting skills required in order to do that. Simply configure the DimissButton Enabled to False in the config.xml 🙂

  16. Hi, congratulations for the job done.
    Is it possible to assign a command like “shutdown -r -t 30” to the action button?

    Thanks a lot and congratulations again
    Nick

    Reply
    • Hey, and thank you. I’m afraid that the API in Windows doesn’t allow that. The notifications in Windows 10 has very limited actions allowed and running a shutdown command is not one of them. (you are allowed to redirect to other UWP apps, but not run custom code. This is due to security reasons)

      Reply
  17. FYI
    If you are using Bitdefender Endpoint Security Tools, it really doesn’t like the script.

    It flags New-ToastNotification.ps1 as malware via it’s advanced threat control, because it’s being executed hidden when running as a sheduled task.
    You can instead do something like %comspec% /c start “” /min “C:\ProgramData\ToastNotificationScript\PendingReboot\RunToastHidden.cmd” (edit RunToastHidden.cmd to include an exit), but then it’s not completely hidden when running.

    But Bitdefender also doesn’t like, if you are adding the scheduled task via powershell, instead of via a GPO.

    I’ve opened a ticked with their enterprise support, to see if this can be fixed with the software.

    Reply
      • No problem, it’s a neat script 🙂

        I’ve worked more into the problem, and it appears Bitdefender doesn’t like when executing the powershell scripts unrestricted. So i changed the executepolicy to remotesigned, and that seems to do the trick. Will test a bit further and give a final update on this issue. I guess you could sign the scripts with an internal certificate, to really avoid this issue and run them with AllSigned.

        Reply
        • And a final note on this issue. Bitdefender has added exclusions for this script to their signature files. That combined with using RemoteSigned, and it’s not a problem anymore 🙂

          Reply
  18. Very excited to use this to start nudging my users from 1607 to 1809! Only problem I am having is with an ampersand – which is an unavoidable part of our department name (the line where you have Helpdesk kindly reminding them). Every substitution I’ve tried either makes the dialog fail to display, with the text failing to convert to XML (Error: “‘ ‘ is an unexpected token. The expected token is ‘;’.) or the dialog displays, but with the ampersand missing. I’m thinking maybe I need to double escape it somehow…?

    Reply
  19. Hello Martin,

    Is it possible for the toast notification to be movable? Also, sometimes, some parts of the text are not shown because of the display resolution.

    Hope you can check this.

    Reply
    • The toast notification is native to Windows 10 and to my knowledge, it’s not possible to move any toast generated in Windows 10. I haven’t tested weird resolutions/zoom levels I’m afraid, but I will when I get the chance. Thanks for the feedback 🙂

      Reply
  20. Nice. Got it to work

    Nice feature would be multi language. Let the script look at the language settings a user has and apply the correct configuration. If the language is not in a configuration file then use English ( or a default language in configuration)

    We have device all over the world. I now put the correct configuration file (translated) on the device of the user trough a GPO attached to the country OU for that user. But there are some user that are in example Dutch OU but speak only English and have there device set on English.

    Reply
  21. Is there a way of adding a hyperlink to the toast notification script in the description maybe? I’d like to ask users to go to an internal website to take an action. I absolutely love this script! Great job.

    Reply
  22. Hello Martin!

    I would like to ask, how should I deploy this as a program? It’s a simple application? If yes, then how should I “detect” under SCCM?

    When I deploy it via SCCM, I need something what can “detect” the actual application deployment.

    Should I try with Task Scheduler and simple Powershell script running? Or I should simply push out as a Powershell Script via SCCM?

    Regards,
    Krisztián

    Reply
  23. Hi Martin,
    Great Job on this, we are about to upgrade to windows 10 1809 and I found your tool. It looks great.

    Is there a way to get it to recognize the swedish letters ÅÄÖ?
    It worked great in version 1.

    Reply
  24. Hi Martin,

    I have solved the Swedish letters problem, I just had to Save as with UTF-8 format and then my letters were shown as they should.

    I have another request,
    When I run the script and choose install/upgrade the Software Center opens but hte SC window isnt in focus and hides behind other windows. Is there a way to make the SC window to be on top?

    Reply
    • I have the same problem – After choosing install/upgrade Software Center opens but hides behind other windows. It’s very confusing for users. How to overcome this?

      Reply
      • Yeah, I think this is a Windows/Software Center issue, rather than a script issue. I use Start-Process to launch the software center, passing the -WindowStyle parameter to maximized. I’m not sure I can do much else. It’s like referencing an application via the link in the Software Center. If that is being shared, lets say on an email, I see the Software Center sometimes come up behind other applications as well. 🙁

        Reply
    • Yeah, I think this is a Windows/Software Center issue, rather than a script issue. I use Start-Process to launch the software center, passing the -WindowStyle parameter to maximized. I’m not sure I can do much else. It’s like referencing an application via the link in the Software Center. If that is being shared, lets say on an email, I see the Software Center sometimes come up behind other applications as well. 🙁

      Reply
  25. Hi Martin. I am trying to launch powershell localy with my current user and the same if Sccm is runing package with user context than he do not have rights to write log. I am getting this error:
    Access to the path ‘C:\ProgramData\ToastNotificationScript\New-ToastNotification.log’ is denied.
    and also getting this error:
    Toast notification is not enabled. Please check \\server\share\config-toast-reminder.xml file
    in xml file toest is enabled <Feature Name="Toast" Enabled="True"
    When I change in PS ALLPROFILE to APPDATA notification appears.
    SCCm program is runs Only when User is logged on and Run with user rights

    Reply
  26. I noticed you’ve added Windows 10 Toast Notification Script Reboot Protocol.msi to the package and mentions ToastReboot in the changelog, but no really deeper information about this new feature in documentation. Can you maybe elaborate how it’s intended to be used?

    Thanks.

    Reply
  27. I recently found that in my own environment the RunToastHidden.cmd needed at -ex bypass added or the Toast wouldn’t appear. YMMV… just putting it out there for anyone else that find the Toast isn’t appearing.

    Reply
  28. Thanks heaps. Works really well. When deploying this via Config Manager, how often would you schedule the program? Once a day?

    Reply
  29. Hi Martin

    Firstly my congratulations on such a great upgrade to SCCM’s user communication.

    We’ve been using this for a few months now and was making the upgrade to 1.2 to use the “Restart Now” button.

    All works as before but clicking on the “Restart now” button brings a popup with “You’ll need a new app to open this toastreboot”

    Any ideas and thanks in advance!

    Reply
  30. Hi, I noticed up above someone posted about adding a hyperlink into it somewhere. I had thought I had asked at one point too. Any chance this is a simple thing to do ?

    I’d like to have a link that users can click on for more information or instructions if possible.

    Reply
    • Yeah I saw your request. Should be possible with some teaking. I will look into it. Haven’t tried it yet 🙂

      Reply
      • Another vote for allowing to have hyperlinks in the toaster text to point to an internal IT Support website. It would be yet another great feature to add to this amazing tool.

        Reply
  31. So I got the whole working with some modifications.

    Notification Popups (with some customization) > its takes to the Assigned OS Upgrade Application on Software Center > the application launches the Upgrade TS.

    The laptop reboots…and after some time I still get the Toast Notification. How can I disable it not to run if Win 10 was upgraded to 1809?

    Reply
    • Hey, the script is able to run conditionally based on the running OS build. If you set the correct build number in the xml config, the script may run with SCCM but the toast is not shown for the user.

      Reply
      • ok, I got this working as suggested, Thank you. I had a wrong build number in their.

        Another issue which doesn’t fit in our environment – I noticed, may be again, I missed something. The installation deadline portion.

        When the application in this “https://www.imab.dk/how-can-i-in-place-upgrade-to-windows-10-1803-using-powershell-app-deployment-toolkit-using-the-software-center-in-configuration-manager/” is being deployed as “Deployment – It goes without saying, but the application you just created and the upgrade task sequence intended to run, needs to be deployed (both as available in this scenario).”, how the Toast Notification will run it when you specify your own deadline. In this case, as of writing now, I had the deadline mentioned in Toast Notification for Aug 8th, but the installation did not happen.

        Am I missing something?

        Thanks for your great help.

        Reply
  32. I’m finding that when using softwarecenter:Page=OSD for the Action button that Software Center is launched but it is not brought to the front as the active window. It is launched but sits behind other open windows. This is difficult for the user to find. Is there a fix for this?

    Reply
  33. Hi Martin,
    could you please assist me with deploying the toast? Our goal is to distribute notification real time to every active pc – so Script is the best option to deploy toast so i did this Script:
    New-Item -Path “c:\” -Name “Apps” -ItemType “directory”
    New-Item -Path “c:\Apps” -Name “Notifikace” -ItemType “directory”
    Copy-Item “\\srv-sccm\PackageSource\Notifikace\” -Destination “C:\Apps\Notifikace\” -Recurse
    powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -command C:\NemJiApps\Notifikace\David_kamery\New-ToastNotification.ps1 -Config “C:\NemJiApps\Notifikace\David_kamery\config-toast.xml”

    And the resault is, that the toast copies, runs but fails with this in log:
    2019-07-29 10:22:54 INFO: Successfully loaded C:\NemJiApps\Notifikace\David_kamery\config-toast.xml
    2019-07-29 10:22:54 INFO: Loading xml content from C:\NemJiApps\Notifikace\David_kamery\config-toast.xml into variables
    2019-07-29 10:22:54 INFO: Successfully loaded xml content from C:\NemJiApps\Notifikace\David_kamery\config-toast.xml
    2019-07-29 10:22:54 INFO: PendingRebootUptime set to True. Checking for device uptime
    2019-07-29 10:22:54 INFO: Greeting with given name selected. Replacing HeaderText
    2019-07-29 10:22:54 INFO: Running Get-GivenName function
    2019-07-29 10:22:55 INFO: No given name found. Using placeholder
    2019-07-29 10:22:55 INFO: Creating the xml for no action button
    2019-07-29 10:22:55 INFO: Toast notification is used in regards to pending reboot. Uptime count is greater than -7
    2019-07-29 10:22:55 INFO: All good. Displaying the toast notification
    2019-07-29 10:22:55 INFO: Something went wrong when displaying the toast notification

    Can you please help me find out how to deploy Toast via Script?
    I am Out of options
    Thank you and have a great day!
    Jiří

    Reply
  34. Hi and thank you for the really impressive script and all the explanations!

    Is it possibly possible to insert a hyper link in the text? would like to link to a html page so that users are informed about news.

    Thank you

    Reply
  35. Hello, thank you for the great script.

    Is it possible to place a link in the text field that points to a company intranet page?

    Many thanks

    Reply
  36. Great Toast schema, and easy way to make ajustment to the schema. It worked very well with SCCM Configuration Manager, when i copy files to the local system. And made a schedule Task. But I ran into problems if I wanted to make a package that runs in a SCCM schedule. I can see that the package is running on the local system, but I can see that it failed in the ToastNotification log. See

    2019-08-27 10:04:02 INFO: No config file set as parameter. Using local config file
    2019-08-27 10:04:02 INFO: Successfully loaded C:\WINDOWS\ccmcache\11\config-toast.xml
    2019-08-27 10:04:02 INFO: Loading xml content from C:\WINDOWS\ccmcache\11\config-toast.xml into variables
    2019-08-27 10:04:02 INFO: Successfully loaded xml content from C:\WINDOWS\ccmcache\11\config-toast.xml
    2019-08-27 10:04:02 INFO: Creating the xml for no action button and no dismiss button
    2019-08-27 10:04:02 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots. Displaying default toast
    2019-08-27 10:04:02 INFO: All good. Displaying the toast notification
    2019-08-27 10:04:02 INFO: Something went wrong when displaying the toast notification.

    What does it means when it write that error at the last line of the log file ??

    It is something to do with the ExecutionPolicy in the command line ?? Or that it is missing the Toast config file. My Command line is the same, but without the config parameter. See

    powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File .\New-ToastNotification.ps1

    When I run it fra the local system it works. What is wrong ?

    Reply
    • Supply to the content above

      Sccm : Program can run : Only when a user is logged on
      The Run mode is : Run with administrative rights
      No mark in : Allow users to interact with this program

      Reply
  37. Very insterested in 1.4 with the password expiration. When running it, it does not seem to work. Anyone else having similar issues? Was able to make it work after some serious changes, but would like it to work out of the box.

    Reply
  38. What would be the reason why I wouldn’t see the buttons? I’m testing with powershell directly and everything shows except the buttons. It stops at giving me the snooze options. I have the buttons on in the XML. I’m only doing a restart based on a pending reboot. Windows 10 1809. Thanks for any assistance.

    Reply
    • Hey, is that also the case if you use the config-pendingreboot.xml I provide in the download? Sounds like you may have hit the max. cap on text, and if too much text in the actual text boxes, the toast will start removing the buttons.

      Reply
  39. Hi,

    I deploy monthly windows updates using ADR. As I know I cannot put any notification on the ADR.
    Now I want to deploy ONLY a Notification for all users using the script. Can I use and deploy your script to my users ONLY as notification?
    Regards

    Reply
  40. Hi Martin,

    I have tried to change the text in xml file, but it does not work. I get still the originally text notification.
    Any Idea why?

    Best regards

    Keywan

    Reply
    • Hey, are you sure you are modifying the right .xml file? I included multiple examples, but only the config-toast.xml is loaded by default unless you specifically specify another 🙂

      Reply
  41. Hey again,
    I have modified ONLY the config-toast.xml. For example I modified the deadline time and Software Center*www.imab.dk
    But nothing change

    Reply
  42. Hey Martin. Thanks a lot for the great script. I noticed above some people asking for button which can redirect to a website. I also had similar requirment, as in my organization we needed to use Toast notification to share important communication. To achive it, in the cofig xml i changed the and renamed the action button the “Navigate”. So when i click at Navigate, it redirected my to the provided URL.

    Reply
  43. I also had similar requirment, as in my organization we needed to use Toast notification to share important communication. To achive it, in the config xml i changed the line (Action Value=”microsoft-edge:URL)and renamed the action button the “Navigate”. So when i click at Navigate, it redirected my to the provided URL.

    Reply
  44. Martin Bengtsson
    October 2, 2019 at 11:05 am | Reply
    Can you paste the content of the logfile: programdata\Toastnotificationscript\

    Hi Martin,
    I found the Error message. I had open the xml file with papad and forget to select utmf 8.

    Could you tell me please the following questions?

    1) I want to deploy only the notification for user that he can see there are windows or office updates?
    2) If the click on the “Snooze” and select 2 hours, where were it saved on the local machine?
    3) the same question for “Dismiss”?

    Thanks again for help.

    Reply
  45. Awesome script. I did find an issue for my environment using the Get-GivenName function.
    I had to modify line 214 and 217:

    214 – added “select -First 1” because seeing this as array sometimes and since the userSID is the same it works
    $DisplayName = (Get-ChildItem -Path $RegKey | Where-Object {$_.GetValue(“LoggedOnUserSID”) -eq $LoggedOnSID}| Select-Object -First 1).GetValue(“LoggedOnDisplayName”)

    217 – changed split to [1] because our display names are last,first
    $GivenName = $DisplayName.Split()[1].Trim()

    Reply
    • Wonderful. Thanks for letting me know. I see how the logged on SIDs might return an array and I’ll make sure to fix that for future releases 🙂

      Reply
  46. Hey Martin,

    This is such an awesome script, currently blowing minds with the custom images at my company! I did have one question for you though, I am wondering if there is there a way to get either get the Action button to open a website such as https://passwordreset.microsoftonline.com for the password reset toast, and or add a clickable url link in the body text?

    Thank you!

    Reply
  47. Hi,

    This is a pretty cool feature!!

    Is there a way to remove the notification once the upgrade is completed?

    Is there a way to change the background color from Grey to others.

    Regards,
    Sabari

    Reply
  48. One question. My aim is to run this script as a part of my Win 10 upgrade. I want to run it locally as a task in task scheduler. The reason for this is that some of the upgrades will take place over the internet and we dont have a cloud distribution point (only CMG). I created a SCCM package that is targeted to my deploy collection that creates the task in task scheduler and copies the necessary files to a certain ProgramData folder. I am using “Users” for the “When running the task, use the following user account” but it isnt working. Only users that have admin rights see the notification. Any ideas ?

    Reply
    • Does the script actually run and thus write to the log file? In that case, what does the log file say when running the script through the task scheduler in the users context?

      Reply
      • Found out what was the actual problem. New users that log in to the computer dont have the rights to modify new-toastnotification log file. Seems that the main use case for this script is when a computer has only one user ?

        Reply
        • You can move the log file to a better suited location in the write log function in the first section of the script. Sounds like you want to have a unique log file for each user logging in, thus I’d move it to the users profile 🙂

          Reply
  49. Hi Martin,

    How often check the script the uptime and show the message?
    And where can I configute the interwall? It should popup 3 times during the day.
    Is that possible? If yes how?
    Thanks
    Azam

    Reply
    • Yes, that’s possible. You configure the schedule with Configuration Manager or with the scheduled task depending on your choice 🙂

      Reply
  50. Thanks for replay. with Configuration Manager I can schedule as customer interval for example every 2 Hours. But it popup every 2 hours every day. It should popup only one day but 3 times. With scheduled task I have to do that locally on the machine? How can I do that?
    Thanks

    Reply
  51. Hello Martin,

    super script. Is there anyway to display the “hostname” on the Notification?
    Our Users has two windows client machine, it would be nice to have the “hostname” as well on the Notification

    Thanks

    Reply
  52. Hello, this is amazing!
    We do have one problem in our environment though – powershell constrained language mode. It probably is set by applocker. Wouldn’t want to disable it since it’s good for security. Has anyone any experience with this? What would be the best way to deal with it?

    Reply
    • Yep, having applocker forces constrained language mode. To my knowledge, that won’t work with the content of my script. However, scripts allowed by AppLocker rules, such as scripts in trusted directories or signed by a trusted code-signing certificate, should run in full language mode

      Reply
    • I’m not sure if Windows actually accepts a snooze timer longer than 1 day, but I guess you can modify the content of the script in this case. The snooze timer values are in there with creating the .xml for the toast notification 🙂

      Reply
  53. Hello Mr. Martin,
    I use your script on our company and the user is very satisfied. Many users told me if I can set the machine name of the client in the notification. Because our user has two windows client machines, one is locally and the other is remote machine. It is not easy to know which machine has received the notification.
    Best regards
    Jason

    Reply
  54. Hello Martin,
    I have a issue with script. some client does not receive Notification. I did review some settings on the Client.
    The REG “HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings” and “Microsoft.SoftwareCenter.DesktopToasts” is enabled. I have disabled it and log off and log on and enabled again, no change.
    I try to run on Command line this: C:\Windows\CCM>SCToastNotification.exe “test” “test”, No Notification displayed.
    In Windows under “Notifications & actions” settings applet” the Software Center does not appear.

    On my machine is showing under “Notifications & actions” settings applet” the Software Center, and I can run C:\Windows\CCM>SCToastNotification.exe “test” “test” and it works.

    Login with different user does not work too.

    Do you have any Idea what I can do?
    Best Regards
    James

    Reply
    • Hello,
      Sounds like the SCCM client isn’t properly installed. You can switch to doing the notification with Powershell. That’s done in the config file. Does the script run, when run manually? What does the log file say for the situation where nothing is shown? 🙂

      Reply
      • Hello Martin,
        I have uninsatlled SCCM Client and install again. No change. The Reason is the Software Center. That is not displayed on the “Notifications & actions” settings .
        Maybe I am wrong.
        Regards

        Reply
  55. Hello, the SCCM Client is installed. The Script does not manually too with no error. I have checked on many machines. If the Software center is not showing on the “Notifications & actions” settings applet”, it does not display any message. I run your script with .\New-ToastNotification.ps1 -Config .\config-toast-osupgrade.xml with Powershell. It is runing without any error, but it is not displaying.
    ONLY if the Software Center is showing in “Notifications & actions” settings applet” in windows, then it does work.
    But I dont know hwo I can add the Software center in “Notifications & actions” settings applet”.
    Regards
    James

    Reply
    • What I meant was, that you can switch the notification over to being done with Powershell and not rely on the SCCM client. I can’t tell why the SCCM client isn’t properly registered with some of your devices 🙂

      Reply
          • Thanks again, I did that
            I get that error

            Get-Service : Cannot find any service with service name ‘ccmexec’.
            At C:\users\Nasser\Downloads\ToastNotificationScript1.4.2\New-ToastNotification.ps1:204 char:13
            + if (Get-Service -Name ccmexec) {
            + ~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo : ObjectNotFound: (ccmexec:String) [Get-Service], ServiceCommandException
            + FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetServiceCommand

          • Sorry for wrong error,

            I see in the log file following:

            Error. Conflicting selection in the .\config-toast-osupgrade.xml file
            2019-10-17 20:13:28 WARNING: Error. You need to enable at least 1 app in the config doing the notification. ie. Software Center or Powershell

        • Ok I have disabled them, it is runinig now on the machine without sccm client.
          What does mean for me? What is wrong with sccm client? Waht can I do?

          Reply
          • I don’t know whats wrong with the SCCM client on your devices I’m afraid, but using Powershell as the app doing the notification is just fine 🙂

  56. From the log file: “Something is not right about toast notifications in Windows. The script will run, but toasts might not be displayed”

    Everything else in the log appears fine. Getting the notification the the toast is not displayed. Using SCCM. Any thoughts on what to check that might be preventing the toast display?

    Reply
    • Is that coming from running the script manually or with SCCM?

      That line in the log file is from checking for the existence of a registry key/value which is normally associated with whether toast notifications are enabled or not in the OS. If you search for notifications in your settings app, you will get a bunch of setting related to notifications. This is also the place where you are able to disable/snooze notifications in general.

      Reply
      • Only when running with SCCM package. Went back to “out of box” configs for troubleshooting. Toast displays correctly when running the script manually even though the log file still indicates “something is not right”. Still only getting notification when running with SCCM. I’ve been trying different options within the SCCM package/program/deployment and can’t seem to get it going.

        Reply
        • The “something is not right” is looking for the registry key usually indicating whether notifications are disabled are not, but I realize notifications can be enabled without the key present, which is why I allow the script to continue.

          If the script works manually, it will work when run with configmgr. Are you making sure to run it in the user’s context?

          Reply
          • My program properties are set to “only when a user is logged on” and “run with user’s rights”. Also verified user context in execmgr.log.

            Using command from the documentation: “powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File .\New-ToastNotification.ps1 -Config “\\server\source$\software\ToastNotificationScript\Config\config-toast-osupgrade.xml”

          • Must be the permissions on the share I was using or the fact that it was a hidden share. The log file didn’t indicate there was any problem accessing or loading the .xml but clearly something wasn’t right. The toast displays perfectly when I put the .xml on a different share or in the sccm package.

            Thanks for your help and your work on this script!

  57. Good Morning,

    I’d like to use this toast notification script for reminding users of pending reboots after their windows updates have installed. The updates are deployed via SCCM (1902).

    I have configured the toast notification script as package within SCCM and deployed to a test collection. I can see the package in software center, however as the device is pending reboot it will not run as software center says ‘unable to make changes to your software until the computer is restarted’ if running via software center or if waiting for scheduled ‘required’ time in execmgr.log you get “program is ready but can not be started because package, program is currently running”. You can reproduce this behavior by sending a client notification>restart from the SCCM console.
    The script/package is able to run perfectly if its not sccm/software center requiring a restart (only PendingFileRenameOperations found in registry).

    Is it not possible for it to run whilst the device is pending reboot from SCCM? Wanting to use this temporarily until i’m able to upgrade the platform to 1906 or 1910 and make use of the new built in restart dialogue box functionality.

    Regards

    Reply
  58. Is it possible to adjust toast message duration time?
    Right now it displays til’ user clicks on it, but we would like to change it to 30 seconds.

    Overall this script is awesome!

    Reply
    • Yes, that’s possible from modifying the config file and the option: Scenario. Set this to long instead of reminder and you have it displaying for about 30 seconds.

      Reply
      • Is there currently a way to make it only stop display when a user makes a conscious decision (selecting restart or dismiss). I don’t want my users to have the ease of just clicking the toast notification box and having it vanish. I would like it to persist until they click dismiss or restart. Thanks in advanced

        Reply
        • Doing further research on this page, I have found someone else asked a similar question. It is true that this functionality is native to Windows and can not be overridden?

          Reply
          • Correct. The toast notifications are native to Windows. Similar to any other notification made in Windows, clicking the notification itself is equal to dismissing it. I cannot prevent that.

  59. Thank you, and thank you again for sharing this script. It is a very nice work. Well done!!!!

    My concerns are as follow:
    When I run it with logon user, it fails due to permission.
    Here is the log error:
    PS C:\Users\kdkossiv\Downloads\ToastNotificationScript1.4.2> powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File C:\Users\kdkossiv\Downloads\ToastNotificationScript1.4.2\New-ToastNotification.ps1
    VERBOSE: Running supported version of Windows. Windows 10 and workstation OS detected
    powershell.exe : Out-File : Access to the path ‘C:\ProgramData\ToastNotificationScript\New-ToastNotification.log’ is denied.
    At line:1 char:1
    + powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoPro …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (Out-File : Acce…log’ is denied.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

    At C:\Users\kdkossiv\Downloads\ToastNotificationScript1.4.2\New-ToastNotification.ps1:132 char:48
    + … FormattedDate $LevelText $Message” | Out-File -FilePath $Path -Append
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OpenError: (:) [Out-File], UnauthorizedAccessException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

    VERBOSE: Something is not right about toast notifications in Windows. The script will run, but toasts might not be
    displayed
    Out-File : Access to the path ‘C:\ProgramData\ToastNotificationScript\New-ToastNotification.log’ is denied.
    At C:\Users\kdkossiv\Downloads\ToastNotificationScript1.4.2\New-ToastNotification.ps1:132 char:48
    + … FormattedDate $LevelText $Message” | Out-File -FilePath $Path -Append
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OpenError: (:) [Out-File], UnauthorizedAccessException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

    How can I run it as a system and just select the logged user name to display it on the toast notification?
    When I run it as System or admin it can display because it need a login user. (logs):
    ERBOSE: Running Get-GivenName function
    VERBOSE: Given name retrieved from Active Directory
    VERBOSE: Creating the xml for displaying both action button and dismiss button
    WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
    VERBOSE: Toast notification is used in regards to pending reboot. Uptime count is greater than -6
    VERBOSE: All good. Displaying the toast notification
    WARNING: Something went wrong when displaying the toast notification
    WARNING: Make sure the script is running as the logged on user

    Reply
    • The script needs the current user’s context. If another user created the log file in programdata, it’s possible that another user won’t be able to write to the file. You can move the log file into the users profile instead, ie. appdata.

      Reply
  60. Hello Martin,

    We’ve carried out a quick test on some Windows 10 version 1511 (10586) clients and the notification is generated less the images and main text. Is this a limitation on the OS version as it certainly works well enough on version 1709 and above?

    Reply
    • Hello, yeah there are certain requirements to minimum 1709. btw, don’t use 1511 – it’s no longer supported 🙂

      Reply
  61. Dear Martin,
    I can only say super job and super script. I agree with other users and would be very nice to have the host name as well.
    many thanks
    Jane

    Reply
  62. Good evining,
    I have asked before some weeks ago about hostname.
    Do you have any news? I would like to have the hostname to display in the notification
    Regards
    Steve

    Reply
    • I will, when I have time to take a look on the entire script again. I’m sorry, I’m not working on the script every day.

      If you are familiar with powershell, you could also do it yourself 🙂

      Reply
  63. Hello,
    I’ve created sccm package and add client program run with administrator rights but it just run the program when the loged user has a local administrator rights. If the user hasn’t a local administrator rights it doesn’t appear toast notification on the user screen. How can i run the program without local admin rights?
    Regards
    Jack

    Reply
  64. Hello Martin,
    If i run the program with user rights. Powershell appeared on the screen and disappeared but toast notification did not appear on the screen. I’ve looked the software center the app seemed retry.
    Regards
    Jack

    Reply
      • 2019-10-29 19:49:45 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
        2019-10-29 19:49:45 INFO: Something is not right about toast notifications in Windows. The script will run, but toasts might not be displayed
        2019-10-29 19:49:45 INFO: Successfully loaded \\sccm16\shared_files\everyone_share\config-toast.xml
        2019-10-29 19:49:45 INFO: Loading xml content from \\sccm16\shared_files\everyone_share\config-toast.xml into variables
        2019-10-29 19:49:45 INFO: Successfully loaded xml content from \\sccm16\shared_files\everyone_share\config-toast.xml
        2019-10-29 19:49:45 INFO: Greeting with given name selected. Replacing HeaderText
        2019-10-29 19:49:45 INFO: Running Get-GivenName function
        2019-10-29 19:49:45 INFO: Given name not found in AD or no local AD available. Continuing looking for given name elsewhere
        2019-10-29 19:49:45 INFO: Looking for given name in WMI with CCM client
        2019-10-29 19:49:45 INFO: Creating the xml for no action button
        2019-10-29 19:49:45 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
        2019-10-29 19:49:45 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
        2019-10-29 19:49:45 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
        2019-10-29 19:49:45 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
        2019-10-29 19:49:45 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
        2019-10-29 19:49:45 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
        2019-10-29 19:49:45 INFO: All good. Displaying the toast notification
        2019-10-29 19:49:45 WARNING: Something went wrong when displaying the toast notification
        2019-10-29 19:49:45 WARNING: Make sure the script is running as the logged on user

        Reply
        • !2019-10-29 19:49:45 WARNING: Make sure the script is running as the logged on user! is the culprit. Don’t run it as system, run as the logged on user 🙂

          Reply
  65. Hi Martin,

    Just stumbled across this, really really usefull but i am stuck, using sccm 1903 the software center “OS” tab does show a ‘share’ icon to get a url to apply to “Action” value=”ToastReboot:” is there another way to generate the url ? i have tried searching online but can find nothing ! My users will need this

    Reply
    • Triggering a TS directly from the toast requires some additional steps. The best approach is to have an application, triggering the TS. This I have covered when using PSADT to upgrade Windows 10. Search on my blog 🙂

      Reply
  66. I’d like to find the scopeID/ApplicationID of a specific Task Sequence so I can link to it directly in the ToastNotifications script but in version 1906 of Configuration Manager there is no longer a link to the Application ID in Software Center and I cannot find the ID in the Configuration Manager console. Do you have any idea how I can retrieve the direct link to a non OS related Task Sequence published under Applications in Software Center? Would make my migration to Office 365 perfect if I could combine it with a shiny toast notification.

    Reply
    • I don’t know of a way where to directly initiate the Task sequence through a protocol based action, but you can do somethin custom calling a script where it’s possible. Take a look at my post about updating windows using PSADT, there’s a script included which does it.:

      Reply
      • I will look into that. Maybe a feature for future versions could be to call s script when pushing the Action button which would make it possible to do a whole lot of other things when using a Toast Notification. So far it’s a great addition.

        Reply
  67. Hi Martin,

    Great script!
    We already use it for ADPasswordExpiration.

    Right now i’m testing the UpgradeOS part.
    The ToastNotification comes up, install is pressed and softwarecenter:Page=OSD opens.

    But here comes the problem.
    In the OSD page we have four task sequences.
    – Install Windows 10 Education incl. Office
    – Install Windows 10 Education without Office
    – Install Windows 7 Enterprise incl. Office (This will shortly be deleted, when Windows 7 get’s out of support).
    – Upgrade to Windows 10 version 1903.

    I’m afraid we will have some users, who’s not sure which task sequence to pick.
    So we risk some users will pick “Install Windows 10 Education”, which will format the disk and install a brand new OS. Instead of upgrading the OS.

    Are there a way to point out the specific task sequence (Upgrade to Windows 10 version 1903)? Or maybe even call the task sequence directly from the powershell script?

    Reply
  68. This sounds awesome!
    Will test them out, however i have a request.
    Is it possible to create one for a collection with low amount of disk space?

    We’ve experienced that some user’s are not good at cleaning their PC’s themselves.
    Would be nice to use this tool to give them a reminder on this especially if you are running windows upgrades

    Reply
    • Sure, that’d be possible. I figure you already have a collection consisting of devices which are running low on disk space. Simply deploy a custom toast to that collection 🙂

      Reply
  69. I get an error 0x1(1) in Software Center every time it tries to install.
    ToastNotification.log doesn’t say anything.
    I assume it has something to do with user rights.
    Tested to run the program with administrative rights, then the Toastnotification log updates.
    The user account have access to the share. Is their anything i’m missing here? Can a regular user even run a PS script?

    I haven’t edited the XML’s so everything is pretty much by default

    Reply
    • Several options: 1) Try to delete the current ToastNotificationScript folder in C:\ProgramData and rerun the package/program. It has to run with user rights. 2) Move the log file into the user’s profile in $env:APPDATA instead. You bypass the execution policy by running it like so: powershell.exe -ExecutionPolicy Bypass

      If the folder/logfile in programdata was created by another user, I have seen this will result in unique permissions on the folder preventing other users to append to the log file. If so, the script will fail horribly 🙂

      Reply
  70. Hi,

    Great script. I am in the process of making changes for our company to have the toast notification appear in the language installed on the computer. We have 19 languages, so i am including the translations for each language in the XML file. Let me know if you are interested in the modifications.

    Reply
  71. So i’ve played a round with this a bit now and seems great so far.
    However i have one issue so far and it might not be something you can help with but i just wanted to hear if you have any suggestions.

    In the XML i’ve modified the Action button to open a specific webpage:
    <Option Name="Action" Value="https://website.com&sys_id=a3f50914db194450165992b8db96192d&quot;
    Can't share the specific webpage but it's only the last part that triggers an error.

    This is from the log: Error message: Cannot convert value "System.Object[]" to type "System.Xml.XmlDocument". Error: "'=' is an unexpected token. The expected token is ';'. Line 22, position 99."

    If i remove the last bit "&sys_id=a3f50914db194450165992b8db96192d" it works. But then it doesn't go to the specific spot on the website as supposed to.

    Do you have any suggestions?

    Reply
  72. Hi Martin,

    I have got the OS upgrade toast to work of sorts, using SoftwareCentreApp I have set scenario to long but none of the text displays. Ii have checked all the formating but all the users get is GreetGivenName followed by the three buttons action, dismiss, snooze ?

    Reply
    • Best advice here must be to start fresh from one of the configs I provide in the download. I’m not sure where the error is, but sounds like you have been messing around with the various options and now hit something unsupported 🙂

      Reply
      • is the actual syntax for “scenario” type=”reminder” “reminder | long” or “reminder | short “, i think i made an error by changing it to “scenario” type = “long” ?

        Reply
  73. Hi Martin,
    thanks for this wonderful notification tool.
    Can you let me know how to clear the toast notification saved to action centre. As after reboot, still has multiple events in the action centre when they use the snooze button. Is it possible to include the command “CreateToastNotifier($Appid).RemoveFromSchedule” in the reboot process Thanks for any input.

    Reply
  74. First of all, I want to see this is a very good script, and thank you for sharing with us!
    My question is that is there a way to instruct the script to use the picture globally?
    example, I have the xml shared out on my test server (the ad password one) and the powershell script I have another pic to use. I also have GPO which is replacing the file on the client, right? For some reason if I don’t have the pic I want on their local pc, it’s not reading off my server correctly which involves no pic.

    So with my testing, it looks like the picture needs to be in both the programdata folder for the client and also on the server. Is that true?

    Thanks again.

    Reply
  75. Hi,

    In newer SCCM builds there’s an option to import PowerShell scripts & execute it on devices by rightclicking on the device. However I suspect SCCM does not do this in user context. Would there be any way around this because we would like to send the toast manually instead of through a scheduler. Would there be a way to have PowerShell check the active user on the computer & then execute itself in that context?

    Reply
    • Correct, that is done in system context. You would have to come up with something to invoke the script as the logged on user. It’s doable, but not something that’s currently baked into the script 🙂

      Maybe that’s not a bad idea for an upcoming version, allowing the script to run from system invoking the logged on user’s context 🙂

      Reply
  76. Hello I am testing the solution in a lab.
    I followed the guides so far.
    When I deploy the package it shows in the log success showing the message.INFO:
    “All good. Displaying the toast notification”
    But I do not see any message.
    Later on when I run it from the SW Center it shows up.
    Do you know what could be the reason?

    Reply
  77. I have spent a few hours trying to figure out if I can control the behavior of when my customer’s click the body of the notification. Currently, if you click it it will either disappear or be moved to the action center. I would like to be able to either keep the notification open and only respond to the action buttons (Install, Snooze, Dismiss), or just open the Software Center. Is this possible?

    Reply
    • The behavior of clicking the notification, regardless of it being on the buttons or not, is native to Windows and not something I can control in the script I’m afraid 🙂

      Reply
      • Hi Martin,

        If a user click on body of the notification, it disappear (Native feature on Windows)
        But it never show again ?

        In case of reminder I would like that the notification show again even if user click on body…
        Is there a way to do this ?

        Reply
        • In order for the notification to show again, you would have to rerun the script. This is where a recurrent schedule comes to play. Dismissing the notification will dismiss that instance of the notification and nothing in Windows will make it return automatically. You will have to trigger another notification for it to show again. Hope that makes sense 🙂

          Reply
  78. This is not critical as this kind of script will probably be deployed in program files or similar:
    if script path contains ampersand (&) script fails when creating toast layout.

    Reply
    • In the attached documentation of the download, there’s an example of using the script with group policy and scheduled tasks 🙂

      Reply
  79. Hi
    I tried it. But it didn’t work. Schedule task is not working. When i run the same arguments using the cmd in that pc. It shows the toast. But when i try to do it with group policy schedule task toast is not showing.

    Reply
    • Are you making sure the scheduled task is running in the user’s context? Are you following the directions I made in the documentation? Is anything logged to the log file?

      Reply
  80. Its working now. But i have another problem. As we configure this for ou which contain client pc’s. and not for the server ou. Same user when login in to servers gives wscript error that hidden.vbs is not in the mention location. As i configure file copy part in computer configuration it does not copy files to servers. So.is there any way to hide this error.

    Reply
    • I’m not sure I follow. If you target this to a specific OU only containing workstations, how is this then run on servers? Are you targeting the GPO to all o your users? Don’t do that 🙂

      Reply
  81. Hi

    In a previous response, you said that you are able to notify a user for pending updates.

    This would be really useful for us. Please could you share the info?

    Thanks in Advance.

    Reply
  82. Hello,
    First of all, thank you for this great job, these notifications are awesome !
    I would have one question regarding the special characters encoding in the “config-toast.xml” file.
    Indeed, for the following line (action button), I am trying to set a “mailto:” link with a body message in arguments. However, it seems it does not like the “&” character (I have already tried to escape it using hexadecimal code and [CDATA] tag but to no avail, unfortunately).

    Here is the line I am trying to use at the moment (using the PowerShell app mode) :

    Have you already encountered this issue in the past ?

    Thanks in advance.

    Reply
    • Hi Fred,

      Did you manage to fix it. i have a same requirement to send e-mail by clicking on the action button.

      Thanks a lot in advance

      Reply
  83. Hello,

    This script works very well except for users who have a duplicate screen.

    I can’t figure out how to handle this by GPO.

    Olivier

    Reply
      • Hi,

        The notification does not appear. To see it, we need to click on the notification center.

        By setting the Focus Assist to DISABLED and deactivating “When I duplicate my screen” it works but it must be done on each profil of each station.
        I am looking for a way to manage this via the registry or a GPO, I have 600 computers concerned with interactive whiteboard.

        Thx

        Reply
        • I see… You are not alone on this one I believe. I don’t think focus assist currently can be managed via registry or gpo. You might need to look into using procmon or similar to locate where the settings are being stored.

          Reply
  84. VERBOSE: Toast notification is used in regards to pending reboot. Uptime count is greater than -6
    VERBOSE: All good. Displaying the toast notification

    Yet I get no toast notification

    Reply
    • Hello, does the toast notification perhaps go straight to the action center? Do you have focus assist enabled by any chance?

      Reply
  85. I really like the look and features this SCCM add-on provides, and having compared a number of possible solutions to manage notifications on our SCCM clients, I decided on trying out your script which I have just downloaded (the latest version of your Windows 10 Toast Notification Script from the Technet Gallery – https://gallery.technet.microsoft.com/Windows-10-Toast-9f228eb1)
    Unfortunately when I extract the zip file my Anti-Virus (Trend Micro) complains that the zip contains the HackTool.VBS.InviBat.A spyware within the ‘hidden.vbs’ file (https://www.trendmicro.com/vinfo/us/threat-encyclopedia/malware/HackTool.VBS.InviBat.A)
    Are you aware of this issue?
    Is the hidden.vbs integral to the Toast Notification script?
    If not, are you able to supply a copy of the Windows 10 Toast Notification Script without the hidden.vbs file?

    Thanks in advance.

    Reply
    • I have heard that before, and the .vbs file is only included if you want to run the script completely silent using group policy. You can ignore the file if you intend to use this solely with configmgr. I’m not sure why some AV’s flag that file as malicious, but I think it’s due to the nature of the file running something silent and off the grid. Note: Defender doesn’t flag it, so I assume most is not running into that issue. Thanks for letting me know though 🙂

      Reply
  86. Hello,
    great Script! Is there an overview for all the actions that can be executed by the ActionButton? I know that the actions are very limited due to the Windows API.

    Reply
    • Thank you! Basically all protocol based actions can be run from the toast’s action button. That also goes for any protocols you may create yourself. Some of my other posts on the topic touches base with this as well. 🙂

      Reply
  87. Hello,

    This script is great and has been really useful for prompting OS upgrades where I’ve used it in the past. However, I’m trying to set this up for user pending reboot prompts. It seems to be working OK but I’m finding an issue where your script does not re-enable software notifications if its been disabled by the user (vis notification settings in control panel).

    I can see your script is checking for and setting the registry value: HKCU\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.SoftwareCenter.DesktopToasts to an enabled value of 1. If I turn off software centre notifications through the control panel notifications GUI, then allow the script to renable this registry value it does not re-enable the toast messages. The only way round this I can find is to use the GUI once again to turn notiffcations for software centre off – then back on. Once I have done this I then get the toast notifications displayed again. I have been unable to prevent users disabling software centre notifications via gpo either so I’m not able to use this reliably at the moment. I’m testing on Win 10 1909 with SCCM 1906. Is this something you are aware of? Thanks Nick

    Reply
    • Hi Nick, Martin,

      @Martin well done for this really great job !!

      I have the same issue as @Nick.
      If a user disable notification from GUI, the script set “Enable” registry value to “1” but it’s not efficient…
      The only way to re-enable the notification is to activate it from GUI.

      @Nick, @Martin have you an update about this ?

      Best Regards,
      Clément

      Reply
      • Yes, issue is that the settings is stored in AppData\Local\Microsoft\Windows\Notifications\wpndatabase.db.

        If a notification hasn’t been sent (since the user disabled it), there’s maybe a (of course not supported) way: stop the service WpnUserService, delete/rename the wpndatabase.db file, delete the regkey “HKCU:Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.SoftwareCenter.DesktopToasts” and restart the service again – a new db file is created and afterwards the notification can be sent successfully. Disadvantage of course: most of the notification settings are lost. Basically the old/renamed db file could be written back to get the settings back.

        Reply
  88. Hello!

    I’m facing a problem with the notification’s behavior and so far, I was unable to find an answer in the Microsoft Doc and I suspect that what I want to do is impossible. I think that with your experience related to notifications, you might prove me wrong (Or tell me that it’s indeed impossible)

    I’m using your script with the AD password expiration option. The notification is displayed using a scheduled task. I went with a “On logon” trigger at first but many users never disconnect their session and they might never see the notification.
    So I moved to a trigger at a fixed hour, repeated every days. The problem is that is the session is locked when the time for the trigger happens, the notification is not displayed and it’s simply stacked in the Action Center for you to read it. But many people aren’t aware of that feature so I wonder if there’s an option related to notification (I’m not afraid to modify the XML if needed, I could even push a PR after that if I’m successful) that force it to “reappear” somehow when you unlock your session and it had been waiting for you. Or maybe a way to trigger the same kind of notification from the Focus Assist that tells you you have pending notifications.

    Any idea?

    Reply
    • Hello Michael, I think your troubles might come from you preventing notifications to be displayed on the lock screen (and for good reasons), and I’m pretty sure that if the session is locked and a notification is displayed behind the scenes meanwhile, this notification will simply be dismissed directly into the action center. I’m not completely sure, as I haven’t tested this specifically, but I think this must be related to some of the customization that’s available in the OS around notifications in general 🙂

      Reply
      • Thanks for your quick answer Martin.

        I am fiddling with the notification settings a bit as I write this answer and if I can’t find a solution that fits my need, I will go another route. A task scheduled each time the session is unlocked and a registry key from your script to check the last time the notification has been displayed. If it’s today, do not display it again. If it was at least a day before, display the notification and update the last run date in registry.

        A bit more taxing as their might be many triggers a day but the users won’t be harassed in spite of everything. 🙂

        Reply
      • And it’s done. I have added a condition to limit the display of the notification one time per day with the corresponding setting in the XML config file so that it’s a setting that can be used per notifications (If you have more than one running). I still need to add another option to enable / disable this behavior.

        If this is something that you are interested in adding to your script, feel free to send me an email so I can share my modifications with you. 🙂

        Reply
  89. Hi Martin,

    I am having trouble running script as a currently logged on user using SCCM. I have created package with all required files > Created a program with cmd line %winDir%\Sysnative\windowsPowershell\v1.0\Powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File .\New-ToastNotification.ps1 -config .\config-toast-osupgrade.xml

    Only when a user is logged on > Run mode “Run with user rights”

    Looking at execmgr.log > Program Failed with error code 1

    How do I test this when logged on user don’t have permissions to run scripts?

    Reply
    • Hey, any particular reason for you forcing powershell to launch through sysnative? Also, what does the log file say? The log should be located in AppData\Roaming\ToastNotificationScript\New-ToastNotification.log

      Reply
      • Hi Martin,

        Pls ignore my above comment, it was issue with our Software restriction policy which was stopping PS to run as logged on user.

        Thank you for your Amazing job with notification.

        Reply
  90. Dear Martin, great script.

    is it possible to trigger from your toast Notification directly a specific Task Sequence?

    I assume it should be added at the NAME=Action” Value=”” if yes how to add the command?

    Thank you for your help

    Reply
  91. Hey Martin!

    Love the script and been using it a lot in my environemnt.

    I have a couple of users who never got my Windows 10 Upgrade prompt because they manually disabled notifications in their action center. Didn’t know if you had a way to re-enable notifications (maybe just for software center/powershell)?

    Couldn’t really find a good answer googling away this morning…was hoping you had an answer. Thanks!

    Reply
    • I’m not sure, but I will try to give it a second look. I think I have been looking for it previously without luck. I’ll give it another shot 🙂

      Reply
      • I wrote a little crappy CI to discover if these keys are set or not. It hasn’t been thoroughly tested, but I believe it works. I think it needs a reboot for the keys to start working too.

        #remediation
        $key = ‘HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications’
        $Key2 = ‘HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.SoftwareCenter.DesktopToasts’

        $ToastProperty = Get-ItemProperty -Path $key -name ToastEnabled
        $SCproperty = Get-ItemProperty -Path $key2 -Name Enabled -ErrorAction SilentlyContinue

        if ((($ToastProperty -eq $null) -or ($ToastProperty.ToastEnabled -eq “1”)) -and (($SCproperty.Enabled -eq $null) -or ($SCproperty.Enabled -eq “1”))) {
        Write-Host Compliant
        }else {

        New-Item -Path $key -Force
        New-ItemProperty -Path $key -Name ToastEnabled -Value 1 -Force
        New-item -Path $key2 -Force
        New-ItemProperty -Path $key2 -Name Enabled -Value 1 -Force
        New-ItemProperty -Path $key2 -Name ShowInActionCenter -Value 1 -Force

        }

        Reply
    • Also wrote a little section to only display to the user if their session is currently unlocked. This was some feedback given to me by a couple of my users:

      $currentuser = gwmi -Class win32_computersystem | select -ExpandProperty username
      $process = get-process logonui -ea silentlycontinue
      While($currentuser -and $process){

      Write-Host Locked
      $currentuser = gwmi -Class win32_computersystem | select -ExpandProperty username
      $process = get-process logonui -ea silentlycontinue
      start-sleep 60
      }
      sleep 10
      write-host Unlocked

      Reply
  92. Hi Martin!

    Thank you for the great script! We are running into a problem with the notifications and are hoping you can help. Our scenario is this:

    The toast notification is deployed as a package via SCCM and is scheduled to run daily at 3pm checking for pending reboots in the registry/WMI
    We also have monthly Windows updates with a deadline/forced reboot
    Here’s the rub, if the Windows updates are installed and the user snoozes the SCCM reboot dialog box, our custom toast notification stops running.
    Nothing is written to the toast notification log at all however, our execmgr log displays the following error:
    “A duplicate execution request is found for the program Toast Notification”
    Once the user reboots, the toast notifications resume running as scheduled.

    We would like to have Windows updates install automatically and allow the user 3 days before the enpoint is forced to reboot. During this time, we want the custom toast notification to run as scheduled. Is this at all possible?

    Reply
    • Hey Trish,

      We have a similar request as well with regards the 3 days notification prior a reboot.
      Did you get any further with this?

      Reply
  93. I have tried this on a clean OOB machine as well as in our production environment, and in both I am receiving no toast popup. I am sure that I am doing something incorrect, as it looks like everyone else here appears to be getting this to work for them.

    If I download the zip/extract locally on a laptop that was fresh out the box(Win 10 1809), and run the New-ToastNotication.ps1 Should the notification populate? I get a warning stating “Conditions for displaying toast notifications for UpgradeOS are not fulfilled” but the script continues on. I have merged the ToastRebootProtocol reg file as well. Any ideas would be much appreciated. Without actually getting the toast notification windows to populate, I am struggling to get started with troubleshooting.

    Thanks in advance for any help provided.

    Reply
    • Hey, if you do a fresh download and run the New-ToastNotification.ps1 without specifying a config.xml file, the script defaults into using config-toast.xml. This config is configured to look for uptime of the computer and not upgradeOS, so you must have done some editing of the config files already? 🙂

      Also, can you paste the log file from appdata\roaming\toastnotificationscript? 🙂

      Reply
  94. Hello
    Having issues getting the TOAST to display. When I look at my task sequence logs running this script I see an entry during the password expire check steps that states:
    VERBOSE: Something is not right about toast notifications in Windows. The script will run, but toasts might not be
    displayed
    I do not have a GPO prohibiting toast and I ran criteria in the task sequence to run during a log on, everyday.

    Is task sequence the best option for these scripts?

    Reply
    • Can you clarify. Do you run the script coming from a task sequence? task sequences run in SYSTEM context. That will not work, as the script needs the current users context.

      Reply
      • I ran from a program and task sequence. I did also turned off the feature to ask ” which program to open” from office as it was being triggered when I ran it as a program. Is running from a program the best option? I did abandon the task sequence. thank you

        Reply
      • Hello,

        I am a beginner and I have a problem. I would like to directly launch another powershell script from the action button
        I modified this in the file : config-toast.xml

        Should we do it another way?
        Thank you for your reply

        Reply
  95. Would it be possible to insert a countdown of some kind, and then automatically have the actionbutton pressed when the timer run out?

    Reply
  96. Greetings,

    I found this to be a great tool, but I have a question. On the restart button, can you tell me where that file needs to reside or how it calls to the msi file?

    Reason I ask is because we want to reset the time to allow more time for my users if they want to reboot but we also want to add a few more checks for other apps. We are trying to find out the piece of code that has the button call for the cmd.

    Thank you in advance.

    Reply
  97. Maybe I missed it but I don’t think it is implemented yet.

    You can have multiple config files in a folder/package but only one ToastHeroImage.jpg and ToastLogoImage.jpg.
    I want to have different images displayed with the different configs I use but I don’t want to create a new package for every config just because I need another ToastHeroImage.jpg. Might it be possible to make the images customizable in the config-toast.xml so you can have different images in one package? Maybe the image can have the same name as the xml file to make it more easy to see what images corresponds with a xml configuration file? So Config-Toast-Diskspace.xml has a corresponding image of Config-Toast-Diskspace.jpg and Config-Toast-Diskspace-Logo.jpg ? Or add an option in the XML where you can type the name of the used JPG images.

    Reply
    • Thank you for the feedback – I will take that into consideration. For now you will need to create separate packages for the separate purposes 🙂

      Reply
  98. Hi Martin, thank you a lot for the nice Toast UI.

    I have some remarks:

    – Toast Notification is displayed on lock screen. How can i avoid it?
    – Is it possible to get a schedule Button?
    – When i press “snooze” the notification go away and come back after the specific time. It would be nice when the notification remains in the notification center. When the notification pop up for the first time and i do nothing it goes into the notification center.

    Thank you!

    Kind regards
    Andreas

    Reply
  99. Hi! A nice extension would be some requirements check, before the action button could use.

    – VPN is required when the device is on external network (we have a lot of road warriors)
    – Device is on battery and need to be plugged in
    – Storage check

    Best regards
    Andreas

    Reply
  100. Hello, first thx a lot for this really cool notification script ! We’re using it for pending reboots and now we’re trying to use it for the Windows 10 Inplace Upgrade to 1909. During testing and the first wave of pilotusers I’m asking myself how can be ensured (and monitored) that the user REALLY got the notification (for the IPU it’s essential since there’s a deadline) since it’s possible that the user disables the notification for Softwarecenter or also Powershell. Only setting the ‘Enabled’ regkey doesn’t enable the notification again (in the GUI in the system settings it seems to be enabled but it isn’t) – as far as I could find out because this change isn’t written back to the “wpndatabase.db” in the userprofile (%localappdata%\Microsoft\Windows\Notifications).
    Regarding monitoring if the notification has been really sent, it can be achieved via Windows Event Viewer – there you can see if a notification has been sent to the user. This is at least one indicator that something went wrong. (Get-WinEvent -LogName Microsoft-Windows-PushNotification-Platform/Operational | Where-Object {$_.Id -eq 3052 -and $_.Message -like “*Microsoft.SoftwareCenter.DesktopToasts*”} | Select-Object -First 1)
    If a notification hasn’t been sent (since the user disabled it), there’s maybe a (of course not supported) way: stop the service WpnUserService, delete/rename the wpndatabase.db file, delete the regkey “HKCU:Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.SoftwareCenter.DesktopToasts” and restart the service again – a new db file is created and afterwards the notification can be sent successfully. Disadvantage of course: most of the notification settings are lost. Basically the old/renamed db file could be written back to get the settings back.

    Reply
    • Great thoughts, thank you for sharing those. I’ve spent some time myself into looking on something similar, but came to the conclusion it wasn’t worth the troubles. If user’s are disabling notifications, because there are no way to prevent it, we stick to telling people they can’t do that. If they do regardless, they are the cause for their own troubles. We have managements word for that as well.

      However, your findings are interesting and I will surely be looking into those myself. Again, thank you for taking your time to reply 🙂

      Reply
  101. Hi,
    for the beginning just to say, great work mate!
    I was wondering if you thought about putting custom logs path into the XML customization file rather than ps1? 🙂

    Reply
  102. Hello Martin,

    Thanks for this. I am running this toast notification through task scheduler. I am running this notification everyday at 12:00 p.m. I have deployed the task sequence and deployment type is required and provided the deadline date. There is slightly confusing situation occurred for me. I have created a dummy task sequence to delete this notification. Dummy TS started and deleted the scheduled task but already running notification remains there in the action center. Is there a way to remove this toast notification?

    Thanks,
    Dharmesh

    Reply
  103. Is it possible to determine how long a message is show and how long before a user clicked the action button? Is it possible to capture that into the logs?
    Super neat tool

    Reply
    • I guess some of that info is already logged by the OS itself in the event log: Microsoft-Windows-PushNotifications-Platform/Operational.

      Once my script completes, the OS takes over. Actions taken on the notification itself is logged in above event log, as well as when the notification was shown to the user. Hope that is useful 🙂

      Reply
    • The action button can open a web page yes. Windows does not support having hyperlinks inline in the text fields I’m afraid. 🙂

      Reply
  104. This is a great tool and makes the toast taste better. We have gone through a feature update from 1709 to 1809 and it was painful without user notifications. I was wondering if this tool can be used with Windows Updates and not In-Place task sequences? We found that feature updates are less intrusive but the notifications to the users are poor. Any advice would be greatly received. Cheers

    Reply
  105. I’m currently deploying the PendingRebootUptime to a collection query based on last boot time more than 7 days.
    This ideally works but it’s not 100 % correct as we reuse laptops and therefore they might actually receive the toast as the WQL query can’t look at the uptime. As workaround i’ve made a collection gathering inactive clients and then excluding them from the original collection.
    This works but i guess it’s still not 100 % correct.
    Is there any way to deploy to prod. where it actually only displays if it has exceeded 7 days uptime?

    Reply
    • Hmm, if I get you right, you are relying on the collection and thus hardware inventory. The toast script itself has the ability to look up the computer uptime in real time. Ideally you should simply run the script daily, and if the uptime of the computer – which is being looked up each time the script runs – exceeds the value defined in the config, the toast will display. This is not relying on hardware inventory or any other schedule in the configmgr client.

      Isn’t that what you are looking for? 🙂

      Reply
      • Wow, feeling bad for missing that one. I somehow missed this function in the XML config, so i never modified it and just thought that you would need to base it on query based device collections. It works like a charm after i corrected it 😀

        Reply
  106. Hey, like the toast notification script. In the process of setting it up for my Feature Update deployments. I added some functionality to the 1.6 version. Let me know if you are interested in the code and integrating it.

    When a feature update deployment is used with deadline:
    * Finds feature update by name, ID, or type (specify in xml).
    * Uses the feature update deadline as the “DynamicDeadline”.
    * Displays toast based on update Evaluation State (Reboot|Available – Specify in xml)

    Reply
    • Hey Paul, I’m very much interested!

      Thank you so much for reaching out. This is something I appreciate a lot! Unfortunately the script haven’t made it into GitHub yet, so I would appreciate your changes on an e-mail sent to mab@imab.dk. I hope that’s OK for now, and again, thank you! 🙂

      Reply
  107. Hey, I like your script. Is there anyway to display the machine name or computer name on the script?
    Thanks

    Reply
  108. I’m working on implementing this myself, as a request from our desk is to make the Password Expiration notice super-duper-in-your-face. Is there a way to make the toast not auto-hide to the Notification tray?

    Reply
  109. Hi, cudos for the script. it looks great! I am testing the reboot script and it does opens without no issues. However,when the script open and one click on the reboot bottom, this function does not work and the app selector opens asking what app to use to execute the reboot.

    Reply
    • Hi, have you either installed the custom protocol.msi that comes with the download or have you created the custom protocols yourself? 🙂

      Reply
  110. Hey Guys. I tried using the script but it does not reboot the computer. I did try using the two different methods, the reminder and by clicking on the reboot button. Neither of the two options seems to work. Am I missing.

    Reply
    • In order to enable the toast script to carry out actions, you need the custom protocols that comes with the download. Have you had a look at them? 🙂

      Reply
  111. Good morning,

    Does anyone know how or where to change the wording under the greeting? I can change the URL but i cant find where to change the wording ‘Software Center’.

    Thanks

    Reply
    • Hello, you cannot change Software Center. Windows displays that by default, as this is the actual app triggering the notification. This can be changed to Powershell in the config, whereas this will change in the notification as well. 🙂

      Reply
      • Thank you for the quick reply, not what i wanted to hear but i understand 🙂

        Love this toast notification btw, kudos!

        Reply
  112. little update which I think would be a nice feature, where you can have a custom image per XML file: –

    On the PowerShell add between into the Try statement line 600 (where it gets the XML attributes.
    $CustomHeroImage = $Xml.Configuration.Option | Where-Object {$_.Name -like ‘CustomHeroImage’} | Select-Object -ExpandProperty ‘Image’
    $HeroImage = “file:///$global:ScriptPath/$CustomHeroImage”

    And in the XML file add the following: –

    Reply
  113. Hi,

    Firstly thank you for your work on this.

    I am experiencing this same issue. A Software Center Toast pops up stating “New Notification” for a second or two then disappears

    What did you mean by “Create a package, which downloads the binaries into the CMcache” ?

    I have created a package and enabled “Persist content in the Client Cache” but that didnt resolve the issue, I’ve spent a good few hours trying to understand whats wrong but cant seem to figure out why its not displaying the full notification.

    The log file appears to be fine, no issues other than it skips the reg key check “The script will run but toast might not be displayed”

    Please can you help as I’m a bit gutted I got this far and I’m stuck at this point!

    Thanks again

    Reply
    • Just to add, when I set all buttons to False I now get the images and wording in the Notification but it still disappears within a couple of seconds and this also points to what you said about “Create a package, which downloads the binaries into the CMcache” but I am still struggling with how to achieve this. The package is in the CCMCache folder but the folder name will be different for all devices so how would I reference that folder when attempting to run it via the Program/Package?

      Reply
      • Ignore all of my comments it was my error configuring the Dismiss button with the Scenario setting, its working now in all its glory.

        Just so you know, for me, “long” only seems to be a few seconds with Dismiss button set to False

        Reply
  114. In my organization the value stored in the backup WMI reg key HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\SessionData is in the format Lastname, Firstname. So when local AD wasn’t available the pop up showed “Good morning Lastname,” instead of “Good morning Firstname”. I modified the powershell script with the following to fix this.

    Removed:
    #$GivenName = $DisplayName.Split()[0].Trim()

    Added:
    $pos = $DisplayName.IndexOf(“,”)
    $GivenName = $name.Substring($pos+1)

    Reply
  115. Hello Martin,

    first of all a big thank you for this tool and for your hard volunteer work for the SCCM community 🙂

    I´m trying to use a toast to inform users to update their O365 installation and the action button should trigger an appropriate package for this operation. From what it looks like, the toast notification part goes as planned, packageid is found and written to registry and RunPackageID is ran. But something then goes wrong and the program does not run.

    Here´s an anonymized take from the logs:

    Toast-Notification Log:

    2020-06-10 12.46.17 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
    2020-06-10 12.46.17 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-06-10 12.46.17 INFO: Successfully loaded \\FQDN\UpdateNotification\config-toast.xml
    2020-06-10 12.46.17 INFO: Loading xml content from \\FQDN\O365UpdateNotification\config-toast.xml into variables
    2020-06-10 12.46.19 INFO: Successfully loaded xml content from \\FQDN\O365UpdateNotification\config-toast.xml
    2020-06-10 12.46.19 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
    2020-06-10 12.46.19 INFO: Running Write-PackageIDRegistry function
    2020-06-10 12.46.20 INFO: PackageID: APP0036F was found in WMI as deployed to the client
    2020-06-10 12.46.20 INFO: Writing the PackageID to registry
    2020-06-10 12.46.20 INFO: Creating the xml for displaying both action button and dismiss button
    2020-06-10 12.46.20 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
    2020-06-10 12.46.20 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
    2020-06-10 12.46.20 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
    2020-06-10 12.46.20 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
    2020-06-10 12.46.20 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
    2020-06-10 12.46.20 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
    2020-06-10 12.46.20 INFO: All good. Displaying the toast notification

    Execmgr.log

    IsTerminalServer: 0, IsSingleUserTS: 1 execmgr 10.6.2020 12.46.23 7336 (0x1CA8)
    GetMergedSWDistPolicy – Could not find the policy in WMI for package APP0036F program * execmgr 10.6.2020 12.46.23 7336 (0x1CA8)
    No optional policy available for program, error 87d02004 execmgr 10.6.2020 12.46.23 7336 (0x1CA8)

    I can run the same program the action button should trigger from the software center correctly. I´ve searched everything I can with the error code from the execmgr.log and implemented the following (cases I found were mostly task sequence related)
    – Deployment was first Available, changed to Required with deadline in distant future -> no help
    – “Run this application from task sequence without being deployed – checked, no help

    Any idea what goes wrong? I also get the same error 0X87d02004 if I try to run you RunPackage.ps1 manually from shell.

    Reply
    • Update: I can run programs if I place it in a Task Sequence and trigger the TS through Toast Notification. Sorry if I´ve missed something in your documentations, but is running single packages with “action” not supported?

      Reply
      • Hmm, I don’t recall having tested the scenario with single packages. They might need to be triggered differently. The RunPackageID option is initially made for task sequences. Have you considered creating the Office 365 installation as an application instead, and use the RunApplicationID option in the config? 🙂

        Reply
        • Thanks for confirming the situation for packages. Converting what I´ve done now to run as package to an application should be possible. Initially I chose package as I did not want to fiddle with detection rules and such, my update just runs O365 setup.exe and then triggers OfficeC2RClient.exe to apply the updated settings.

          Reply
  116. On a small number of machines the toast notification does not show up. I am using software center and it is running in user context. I am using version 1.5. I have verified that “Notifications” are enabled, but noticed that there is no entry for “Software Center”

    Any thoughts? Are there known bugs with notifications on Windows 10 1809? Thanks!!

    2020-06-10 13:43:55 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
    2020-06-10 13:43:55 INFO: Toast notifications are enabled in Windows
    2020-06-10 13:43:55 INFO: No config file set as parameter. Using local config file
    2020-06-10 13:43:55 INFO: Successfully loaded C:\WINDOWS\ccmcache\ki\config-toast.xml
    2020-06-10 13:43:55 INFO: Loading xml content from C:\WINDOWS\ccmcache\ki\config-toast.xml into variables
    2020-06-10 13:43:55 INFO: Successfully loaded xml content from C:\WINDOWS\ccmcache\ki\config-toast.xml
    2020-06-10 13:43:55 INFO: DynDeadlineEnabled set to True. Overriding deadline details using date and time from WMI
    2020-06-10 13:43:55 INFO: Running Get-DynamicDeadline function. Trying to get task sequence deadline details from WMI and ConfigMgr
    2020-06-10 13:44:01 INFO: PackageID of task sequence successfully retrieved. PackageID is: CMP0117F. Now getting deadline date and time
    2020-06-10 13:44:01 INFO: Deadline date and time successfully retrieved from WMI. Deadline is: 06/11/2020 07:00:00
    2020-06-10 13:44:01 INFO: Greeting with given name selected. Replacing HeaderText
    2020-06-10 13:44:01 INFO: Running Get-GivenName function
    2020-06-10 13:44:02 INFO: Given name retrieved from Active Directory
    2020-06-10 13:44:02 INFO: Creating the xml for displaying both action button and dismiss button
    2020-06-10 13:44:02 INFO: Toast notification is used in regards to OS upgrade. Taking running OS build into account
    2020-06-10 13:44:02 INFO: All good. Displaying the toast notification

    Reply
    • Hey, does the notification show if you switch over using Powershell as the notifying app? I have heard of some instances where notifications are not displaying if using software center, but they were all related to issues on the client (if software center was not properly installed).

      Windows 10 1809 shouldn’t have any issues that I’m aware of.

      Reply
      • Thanks. I actually switched from Powershell in my pilot group 1 to Software Center in pilot group 2 because we had a few users not getting powershell notifications….I will continue my reasearch!

        Reply
        • Right, the user is actually able to disable the notifications separately for software center and powershell. afaik, no why to prevent that from a management perspective. Is this what’s happening?

          Reply
  117. Hello Martin

    thanks for this great tool. I’ve running and issue … I get the toast notification poping up (OS Upgrade) if I select “Instll now” I see flashing the cmd window … and then nothing happens … The TS package ID is informed … The custom tools are already installed … in fact, I checked the registry keys and are informed, and the folder C:\ProgramData\ToastNotificationScript\ Exists … but no log file is created inside … if I run manually the cmd file from there then the TS starts … but Why is not able the Toast to trigger the cmd file ? and why I have no log file created at this location ? The package is deployed OK and is deployed under user context. I’m able to see the Toast …
    Thanks in advance

    Reply
    • The log file should be in appdata\ToastNotificationScript and not in ProgramData. Any clues in there? If the TS is triggered by running the .cmd manually, running the .cmd from the Install button should be the exact same behavior. What value is registered in the registry here: Computer\HKEY_CLASSES_ROOT\ToastRunPackageID\shell\open\command? It should point to the .cmd file.

      Reply
  118. Hi Martin,

    Thanks for this awesome script!
    I already use it for AD Password Expiration and OS-Upgrade. (FYI. for all my ToastNotification scripts I use your 1.5 version, including the .msi file)

    Due to Covid-19, my company wanted a “pop-up” remembering people to wash hands.
    Therefor i decided to create another ToastNotification program. I decided to use the .xml file called config-toast.xml.

    The script/packages works, and the ToastNotification works.
    But there is a “small” problem. Because in the .xml file I have only enabled the Action button, where I changed the value to “OK”.
    But when people press “OK”, the messages just move to the Action Center. Then you have to open Action Center and press OK again or press the cross.
    I believe this happens because there is no “Action” attached to the Action button.

    Is there a way to avoid this?

    Here is a selection of my .xml file:

    Reply
  119. Probably some amateur-error, but having trouble on initiating PendingRebootUptime -toast.

    After enabling:

    log:
    2020-06-12 14.54.37 INFO: Toast notification is used in regards to pending reboot. Uptime count is greater than -6
    2020-06-12 14.54.37 INFO: All good. Displaying the toast notification

    result:
    empty, generic toast
    SOFTWARE CENTER
    NEW TOAST NOTIFICATION

    Doing this by local powershell-console, as logged-on-user.
    What am i missing?

    Reply
    • I believe something’s amiss in the config. Does it work when running the script directly from the download without modifying anything? The toast itself can act up if you put too much text in there.

      Reply
  120. Hi Martin,

    I love the toast notification, but am wondering if there is an easy way to use it to notify users when there is anything available or required in the software centers? We seem to have low install percentages for available software and until the deadline for required. It would be nice to have something more in a users face than the default balloon popup.

    Thanks!

    Reply
  121. Hey Martin,

    I´ve ran into an issue with the new Version of your script. I think with the 1.6 Version, it is no longer possible to run a package.
    I tried to figure out how the whole thing works an from what i undestand it is like this(for osupgrade): The Toastscript checks if its package or application, promts user, starts something(this is the part I dont understand and i guess here is the error – I only know it needs the the reg key in the classes_root), there the .cmd is written down, the cmd starts the ps1 which then starts the Softwarecenter with some sort of COM-command.
    I ran the Toast script with Application and it works (though i got some errors with the application starting the Task Sequence in the filed-test so I wanted to simplify it and just run the Task Sequence)
    I then changed the .xml to run the package ID, the Logs confirm that the Toast now looks for the package ID and that RunapplicationID is not selceted. But still, it runs the application. After some troubleshooting I just changed the “RunApplicationID” Reg Key entry to run the “RunPackageID.cmd” out of curiosity. And, indeed, this “fixed” the issue.

    So in short: Even though “RunPackageID” is selected, it still runs the “RunApplicationID” Reg Key entry.

    Greetings, Phil

    Reply
    • Greetings! I’m not sure I completely follow, but the action taken on the script is managed via the action attribute, and not from enabling either features. Are you remembering to be switching between ToastRunPackageID and ToastRunApplicationID as an action? 🙂

      Reply
  122. Hello, Wanted to see if you seen an issue where when clicking on the Install option in Toast, the action target app shows “Unknown” status for the application in Software Center so users arent able to install the app because the “Install” option for the app in software center is greyed out. We have tried with diff SoftwareIDs in SoftwareCenter and all apps get the same behavior. The toast works great, but when Toast takes them to software center, they are unable to install, thanks

    Reply
      • Hi Martin, wanted to see if you knew of any workarounds to get it to not show unknown, i sent you a screenshot of our xml file. Please let me know if you see anything off, thanks for your help

        Reply
        • I’m sorry for the very late reply. Vacation mode is on. Did you manage to solve this? So this behavior would also be true, if you simply shared the URL/link to the application via email? So when clicking the link, the app would also have an unknown status?

          Reply
  123. Hello,

    I would like to know if it’s possible: before starting the task sequence there are some conditions for example check the disk space and if it’s too full it suggests to delete some content…

    Do you have a proposal to do this?
    Thanks

    Reply
    • I have something similar explained in a previous blog post where I’m sharing my IPU task sequences. Search for that on the blog 🙂

      Reply
  124. Love the notification! Came back to get the updates and I don’t see the O365 variables any more? Is that no longer supported?

    Reply
  125. So great setup! I have one question how do you get the notification screen to show up with A install button and snooze timer? I can get reboot and dismiss but not install and snooze? In your example it shows all the buttons plus snooze timers? any help please

    Reply
    • If you want a snooze button, enable the snooze button in the config xml. The name of the action button (install, reboot etc.) is also configured in the config xml 🙂

      Reply
  126. Hi Martin
    Great Script. I just start testing i our enviroment. We are not using SCCM but Toast Notification would be a great help anyway.
    Just wondering – why are the xml files the same in version 1.8. Im talking about the notification text. All the xml files contains the text from rebootpending.xml.

    Reply
    • Hey Torben, that is just my copy/paste lazyness. This should only be true for the danish and swedish languages. I figured that one would do their own text anyways and replace mine. It’s the configurations of the individual features that’s relevant 🙂

      Reply
  127. I am an SCCM noob but I am trying to implement this toast notification through SCCM. I get the “Script is being run as SYSTEM” Warning and I can not figure out how to get passed this issue. Can you provide any insight? The package is placed in ccmcache and tries to execute from there.

    Reply
  128. Hello,
    Great script got it working perfectly. I’m using it for notifying users to not touch a PC that is currently installing programs in the background. Is there a way to have the notification stay on the screen indefinitely until a user hits the dismiss button. Thanks.

    Reply
  129. Hi Martin,
    This is an absolutely fantastic solution, one I wish Microsoft would implement into SCCM for notifications!
    I have been using it for a while now and it works great 🙂 I use it to prompt users to restart if required (from uptime or software/patch installation).
    One thing I found, and sharing it in case its helpful, is when Focus Assist is turned ON in Windows, the Toast Notifications wont appear on screen, they go straight to the notification center, which is normal behavior. This can be on because the users turned it on, or in alot of cases gets turned on automatically when in video conference meetings etc.
    I found I could get around this by changing the Toast Scenario from ‘reminder’ to ‘alarm’ in the config xml

    This makes the toast push through focus assist (in any of its states), and still seems to behave as a reminder in that it stays on screen until dismissed. However as it is an alarm, by default it also sounds an audible alert, whatever the default alarm tone is set to on windows 10. I didn’t want this in my scenario. So to make it silent I had to add a line to the XML config sections in the New-ToastNotification.ps1 file as below.

    https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/toast-schema#toastaudio it can enable/disable the audio for the toast, or apparently change what’s played – although I couldn’t get that to work in testing.
    Anyway, hope this is helpful, and keep up the fantastic work!

    Reply
    • Hmmmm ok some of the lines didn’t come through, apologies.
      Changing to alarm was meant to have the line from the config xml –
      Option Name=”Scenario” Type=”alarm” Possible values are: reminder | short | long
      and the line in the ps1 xml sections to make it silent was ” audio silent=”true” ”
      /binding
      /visual
      audio silent=”true”/
      actions

      Reply
      • Hello Andrew, can yoy explain this litt more….. what/why do you change audio silent=”true” En where is this in the .xml ? I do not see it….

        Reply
  130. Hello All,
    Getting a strange error when running the script
    “you’ll need a new app to open this toastrunapplid”
    the strange thing is that i don’t get the error but a couple users do. i ran the script manually on the machine, and the popup works, but when you click install the error pops up. the user( doesn’t work) and i (working) are in the same collection and have the app published to the same collection.
    anyone seen this before?

    Reply
    • This is the action on the action button. On some of my examples in the config.xml files, this is set to ToastRunAppID:. This is a custom protocol I made in Windows manually. You would need to make something similar, if you want the action button to do specific things. What do you want the action button to do in your scenario? 🙂

      Reply
  131. Hello,

    I am a beginner and I have a problem. I would like to directly launch another powershell script from the action button
    I modified this in the file : config-toast.xml

    Should we do it another way?
    Thank you for your reply

    Reply
  132. if you would like the users custom profile picture to display instead of the ToastLogoImage.jpg

    Original
    # Setting image variables
    $LogoImage = “file:///$global:ScriptPath/ToastLogoImage.jpg”

    Replacement
    #Find Users Current ProfilePicture
    Add-Type -AssemblyName System.DirectoryServices.AccountManagement
    $CurrentUser = [System.DirectoryServices.AccountManagement.UserPrincipal]::Current
    $SID = $CurrentUser.Sid.Value
    $FindPicture = Get-Childitem -Path C:\Users\Public\AccountPictures\$SID -Include *-Image192.jpg -Recurse -Force
    $ProfilePicture = $FindPicture.Name
    Copy-Item “$env:systemDrive\Users\Public\AccountPictures\$SID\$ProfilePicture” -Destination “$global:ScriptPath\UserPic.jpg” -Force -PassThru
    $unhide = get-item “$global:ScriptPath\UserPic.jpg” -Force
    $unhide.Attributes=”normal”
    # Setting image variables
    if (Test-Path $global:ScriptPath/UserPic.jpg) {
    $LogoImage = “file:///$global:ScriptPath/UserPic.jpg”
    } else {
    $LogoImage = “file:///$global:ScriptPath/ToastLogoImage.jpg”
    }

    Reply
  133. Hi,
    Although the scenario is selected as reminder (in official document, it says “The notification will stay on screen until the user dismisses it or takes action. On Windows Mobile, the toast will also show pre-expanded. A reminder sound will be played”.),
    notification disappears after 5 minutes, i think that maximum run time for a notification is 5 minutes.
    can you confirm if the working principle is like that?
    Thanks.

    Reply
    • Yeah, I can confirm that. I’m not sure if this is ‘as designed’, but something surely seem to have changed within the OS. 5 minutes is what I’m getting as well.

      Reply
  134. Hello Guys,

    I am really impressed with this Toast notification. but i have some queries to run this on my environment. I need to do the package deployment for end users with this toast notification. I created a Task sequence in this case and inserted the Package ID in the config.xml file. but still its failing and i am not getting pop up on the machine. Any help?

    Reply
    • Hi, can you paste the relevant content of the log file: AppData\Roaming\ToastNotificationScript\New-ToastNotification.log

      Reply
      • So the script is never run properly. I have read your email, and the script should not be run from within a task sequence. A task sequence is running in SYSTEM context unless you actively make an effort in invoking the current user’s context. I recommend that you use a package/program as suggested in the documentation 🙂

        Reply
        • Ok.. I was able to create package and push to the machine and i got the pop up to install also. But when i click on “Install now” its bring the “You’ll need a new app to open this link” searching for app. In the xml file, I provided the package ID and still its not working. Any help please?

          Reply
          • Did you enable the CreateCustomScriptsAndProtocols option in the config.xml? If you want the toast notification to carry out custom actions, you will need scripts located in: ProgramData\ToastNotificationScript. Do you have that? Also, please paste the content of the log file located in AppData\Roaming\ToastNotificationScript

          • Here is the log file.

            2020-08-28 09:08:13 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
            2020-08-28 09:08:13 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-28 09:08:13 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
            2020-08-28 09:08:13 INFO: Successfully loaded C:\Users\nxa07227-a\Desktop\Package deployment\config-toast_Packageinstallation.xml
            2020-08-28 09:08:13 INFO: Loading xml content from C:\Users\nxa07227-a\Desktop\Package deployment\config-toast_Packageinstallation.xml into variables
            2020-08-28 09:08:13 INFO: Successfully loaded xml content from C:\Users\nxa07227-a\Desktop\Package deployment\config-toast_Packageinstallation.xml
            2020-08-28 09:08:13 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
            2020-08-28 09:08:13 INFO: Running Write-PackageIDRegistry function
            2020-08-28 09:08:13 WARNING: PackageID: PS1004E3 was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr
            2020-08-28 09:08:13 INFO: Greeting with given name selected. Replacing HeaderText
            2020-08-28 09:08:13 INFO: Running Get-GivenName function
            2020-08-28 09:08:14 INFO: Given name retrieved from Active Directory
            2020-08-28 09:08:14 INFO: Creating the xml for no dismiss button
            2020-08-28 09:08:14 INFO: Creating the xml for snooze button
            2020-08-28 09:08:14 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
            2020-08-28 09:08:14 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
            2020-08-28 09:08:14 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
            2020-08-28 09:08:14 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
            2020-08-28 09:08:14 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
            2020-08-28 09:08:14 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
            2020-08-28 09:08:14 INFO: All good. Toast notification was displayed
            2020-08-28 09:18:44 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
            2020-08-28 09:18:44 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-28 09:18:44 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
            2020-08-28 09:18:44 INFO: Successfully loaded C:\Users\nxa07227-a\Desktop\Package deployment\config-toast_Packageinstallation.xml
            2020-08-28 09:18:44 INFO: Loading xml content from C:\Users\nxa07227-a\Desktop\Package deployment\config-toast_Packageinstallation.xml into variables
            2020-08-28 09:18:45 INFO: Successfully loaded xml content from C:\Users\nxa07227-a\Desktop\Package deployment\config-toast_Packageinstallation.xml
            2020-08-28 09:18:45 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
            2020-08-28 09:18:45 INFO: Running Write-PackageIDRegistry function
            2020-08-28 09:18:45 WARNING: PackageID: PS1004E3 was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr
            2020-08-28 09:18:45 INFO: Greeting with given name selected. Replacing HeaderText
            2020-08-28 09:18:45 INFO: Running Get-GivenName function
            2020-08-28 09:18:46 INFO: Given name retrieved from Active Directory
            2020-08-28 09:18:46 INFO: Creating the xml for no dismiss button
            2020-08-28 09:18:46 INFO: Creating the xml for snooze button
            2020-08-28 09:18:46 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
            2020-08-28 09:18:46 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
            2020-08-28 09:18:46 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
            2020-08-28 09:18:46 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
            2020-08-28 09:18:46 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
            2020-08-28 09:18:46 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
            2020-08-28 09:18:46 INFO: All good. Toast notification was displayed
            2020-08-28 10:31:05 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
            2020-08-28 10:31:05 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-28 10:31:05 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
            2020-08-28 10:31:05 INFO: Successfully loaded C:\Windows\ccmcache\5\config-toast_Packageinstallation.xml
            2020-08-28 10:31:05 INFO: Loading xml content from C:\Windows\ccmcache\5\config-toast_Packageinstallation.xml into variables
            2020-08-28 10:31:05 INFO: Successfully loaded xml content from C:\Windows\ccmcache\5\config-toast_Packageinstallation.xml
            2020-08-28 10:31:05 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
            2020-08-28 10:31:05 INFO: Running Write-PackageIDRegistry function
            2020-08-28 10:31:05 WARNING: PackageID: PS1004E3 was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr
            2020-08-28 10:31:05 INFO: Greeting with given name selected. Replacing HeaderText
            2020-08-28 10:31:06 INFO: Running Get-GivenName function
            2020-08-28 10:31:06 INFO: Given name retrieved from Active Directory
            2020-08-28 10:31:06 INFO: Creating the xml for no dismiss button
            2020-08-28 10:31:06 INFO: Creating the xml for snooze button
            2020-08-28 10:31:06 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
            2020-08-28 10:31:06 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
            2020-08-28 10:31:06 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
            2020-08-28 10:31:06 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
            2020-08-28 10:31:06 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
            2020-08-28 10:31:06 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
            2020-08-28 10:31:07 INFO: All good. Toast notification was displayed
            2020-08-28 10:54:31 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
            2020-08-28 10:54:31 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-28 10:54:31 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
            2020-08-28 10:54:31 INFO: Successfully loaded C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 10:54:31 INFO: Loading xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml into variables
            2020-08-28 10:54:31 INFO: Successfully loaded xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 10:54:31 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
            2020-08-28 10:54:31 INFO: Running Write-PackageIDRegistry function
            2020-08-28 10:54:32 WARNING: PackageID: PS1004E3 was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr
            2020-08-28 10:54:32 INFO: Greeting with given name selected. Replacing HeaderText
            2020-08-28 10:54:32 INFO: Running Get-GivenName function
            2020-08-28 10:54:32 INFO: Given name retrieved from Active Directory
            2020-08-28 10:54:32 INFO: Creating the xml for no dismiss button
            2020-08-28 10:54:32 INFO: Creating the xml for snooze button
            2020-08-28 10:54:32 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
            2020-08-28 10:54:32 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
            2020-08-28 10:54:32 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
            2020-08-28 10:54:32 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
            2020-08-28 10:54:32 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
            2020-08-28 10:54:32 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
            2020-08-28 10:54:33 INFO: All good. Toast notification was displayed
            2020-08-28 10:57:05 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
            2020-08-28 10:57:06 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-28 10:57:06 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
            2020-08-28 10:57:06 INFO: Successfully loaded C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 10:57:06 INFO: Loading xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml into variables
            2020-08-28 10:57:06 INFO: Successfully loaded xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 10:57:06 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
            2020-08-28 10:57:06 INFO: Running Write-PackageIDRegistry function
            2020-08-28 10:57:06 WARNING: PackageID: PS1004E3 was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr
            2020-08-28 10:57:06 INFO: Greeting with given name selected. Replacing HeaderText
            2020-08-28 10:57:06 INFO: Running Get-GivenName function
            2020-08-28 10:57:07 INFO: Given name retrieved from Active Directory
            2020-08-28 10:57:07 INFO: Creating the xml for no dismiss button
            2020-08-28 10:57:07 INFO: Creating the xml for snooze button
            2020-08-28 10:57:07 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
            2020-08-28 10:57:07 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
            2020-08-28 10:57:07 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
            2020-08-28 10:57:07 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
            2020-08-28 10:57:07 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
            2020-08-28 10:57:07 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
            2020-08-28 10:57:07 INFO: All good. Toast notification was displayed
            2020-08-28 11:05:34 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
            2020-08-28 11:05:34 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-28 11:05:34 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
            2020-08-28 11:05:34 INFO: Successfully loaded C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 11:05:34 INFO: Loading xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml into variables
            2020-08-28 11:05:34 INFO: Successfully loaded xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 11:05:34 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
            2020-08-28 11:05:34 INFO: Running Write-PackageIDRegistry function
            2020-08-28 11:05:34 WARNING: PackageID: PS1004E3 was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr
            2020-08-28 11:05:34 INFO: Greeting with given name selected. Replacing HeaderText
            2020-08-28 11:05:34 INFO: Running Get-GivenName function
            2020-08-28 11:05:35 INFO: Given name retrieved from Active Directory
            2020-08-28 11:05:35 INFO: Creating the xml for no dismiss button
            2020-08-28 11:05:35 INFO: Creating the xml for snooze button
            2020-08-28 11:05:35 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
            2020-08-28 11:05:35 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
            2020-08-28 11:05:35 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
            2020-08-28 11:05:35 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
            2020-08-28 11:05:35 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
            2020-08-28 11:05:35 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
            2020-08-28 11:05:35 INFO: All good. Toast notification was displayed
            2020-08-28 11:07:30 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
            2020-08-28 11:07:30 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-28 11:07:30 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
            2020-08-28 11:07:30 INFO: Successfully loaded C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 11:07:30 INFO: Loading xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml into variables
            2020-08-28 11:07:31 INFO: Successfully loaded xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 11:07:31 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
            2020-08-28 11:07:31 INFO: Running Write-PackageIDRegistry function
            2020-08-28 11:07:31 WARNING: PackageID: PS1004E3 was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr
            2020-08-28 11:07:31 INFO: Greeting with given name selected. Replacing HeaderText
            2020-08-28 11:07:31 INFO: Running Get-GivenName function
            2020-08-28 11:07:32 INFO: Given name retrieved from Active Directory
            2020-08-28 11:07:32 INFO: Creating the xml for no dismiss button
            2020-08-28 11:07:32 INFO: Creating the xml for snooze button
            2020-08-28 11:07:32 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
            2020-08-28 11:07:32 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
            2020-08-28 11:07:32 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
            2020-08-28 11:07:32 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
            2020-08-28 11:07:32 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
            2020-08-28 11:07:32 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
            2020-08-28 11:07:32 INFO: All good. Toast notification was displayed
            2020-08-28 11:11:10 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
            2020-08-28 11:11:10 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-28 11:11:10 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
            2020-08-28 11:11:10 INFO: Successfully loaded C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 11:11:10 INFO: Loading xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml into variables
            2020-08-28 11:11:11 INFO: Successfully loaded xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 11:11:11 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
            2020-08-28 11:11:11 INFO: Running Write-PackageIDRegistry function
            2020-08-28 11:11:11 WARNING: PackageID: PS1004E3 was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr
            2020-08-28 11:11:11 INFO: Greeting with given name selected. Replacing HeaderText
            2020-08-28 11:11:11 INFO: Running Get-GivenName function
            2020-08-28 11:11:12 INFO: Given name retrieved from Active Directory
            2020-08-28 11:11:12 INFO: Creating the xml for no dismiss button
            2020-08-28 11:11:12 INFO: Creating the xml for snooze button
            2020-08-28 11:11:12 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
            2020-08-28 11:11:12 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
            2020-08-28 11:11:12 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
            2020-08-28 11:11:12 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
            2020-08-28 11:11:12 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
            2020-08-28 11:11:12 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
            2020-08-28 11:11:12 INFO: All good. Toast notification was displayed
            2020-08-28 11:18:34 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
            2020-08-28 11:18:34 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-28 11:18:34 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
            2020-08-28 11:18:34 INFO: Successfully loaded C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 11:18:34 INFO: Loading xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml into variables
            2020-08-28 11:18:35 INFO: Successfully loaded xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 11:18:35 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
            2020-08-28 11:18:35 INFO: Running Write-PackageIDRegistry function
            2020-08-28 11:18:35 WARNING: PackageID: PS1004E3 was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr
            2020-08-28 11:18:35 INFO: Greeting with given name selected. Replacing HeaderText
            2020-08-28 11:18:35 INFO: Running Get-GivenName function
            2020-08-28 11:18:36 INFO: Given name retrieved from Active Directory
            2020-08-28 11:18:36 INFO: Creating the xml for no dismiss button
            2020-08-28 11:18:36 INFO: Creating the xml for snooze button
            2020-08-28 11:18:36 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
            2020-08-28 11:18:36 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
            2020-08-28 11:18:36 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
            2020-08-28 11:18:36 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
            2020-08-28 11:18:36 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
            2020-08-28 11:18:36 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
            2020-08-28 11:18:36 INFO: All good. Toast notification was displayed
            2020-08-28 11:19:04 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
            2020-08-28 11:19:04 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-28 11:19:04 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
            2020-08-28 11:19:04 INFO: Successfully loaded C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 11:19:04 INFO: Loading xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml into variables
            2020-08-28 11:19:04 INFO: Successfully loaded xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 11:19:04 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
            2020-08-28 11:19:04 INFO: Running Write-PackageIDRegistry function
            2020-08-28 11:19:04 WARNING: PackageID: PS1004E3 was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr
            2020-08-28 11:19:04 INFO: Greeting with given name selected. Replacing HeaderText
            2020-08-28 11:19:04 INFO: Running Get-GivenName function
            2020-08-28 11:19:05 INFO: Given name retrieved from Active Directory
            2020-08-28 11:19:05 INFO: Creating the xml for no dismiss button
            2020-08-28 11:19:05 INFO: Creating the xml for snooze button
            2020-08-28 11:19:05 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
            2020-08-28 11:19:05 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
            2020-08-28 11:19:05 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
            2020-08-28 11:19:05 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
            2020-08-28 11:19:05 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
            2020-08-28 11:19:05 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
            2020-08-28 11:19:05 INFO: All good. Toast notification was displayed
            2020-08-28 11:23:03 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
            2020-08-28 11:23:03 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-28 11:23:03 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
            2020-08-28 11:23:03 INFO: Successfully loaded C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 11:23:03 INFO: Loading xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml into variables
            2020-08-28 11:23:03 INFO: Successfully loaded xml content from C:\Windows\ccmcache\6\config-toast_Packageinstallation.xml
            2020-08-28 11:23:03 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
            2020-08-28 11:23:03 INFO: Running Write-PackageIDRegistry function
            2020-08-28 11:23:04 WARNING: PackageID: PS1004E3 was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr
            2020-08-28 11:23:04 INFO: Greeting with given name selected. Replacing HeaderText
            2020-08-28 11:23:04 INFO: Running Get-GivenName function
            2020-08-28 11:23:04 INFO: Given name retrieved from Active Directory
            2020-08-28 11:23:04 INFO: Creating the xml for no dismiss button
            2020-08-28 11:23:04 INFO: Creating the xml for snooze button
            2020-08-28 11:23:04 WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
            2020-08-28 11:23:04 WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
            2020-08-28 11:23:04 WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
            2020-08-28 11:23:04 WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
            2020-08-28 11:23:04 WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
            2020-08-28 11:23:04 INFO: Toast notification is not used in regards to OS upgrade OR Pending Reboots OR ADPasswordExpiration. Displaying default toast
            2020-08-28 11:23:05 INFO: All good. Toast notification was displayed

          • Will you be able to provide the step by step instruction if possible please?

            1. We need to install the Windows 10 Toast Notification script custome Action protocol in all user machine first
            2. then need to create customscriptsandprotocols option in config.xml whenever we do the package depoyment?
            3. Do we need to update the runpackageId with package id everytime?

          • Have you got the latest version of the script?

            According to the log, you have not enabled CreateCustomScriptsAndProtocols in the config file. This is required if you want the action button to run the package directly. Also, the package comes out as not deployed to the device. The package should be visible from the Software Center. If this is deployed as required, you need to tick ON ‘Allow the users to run the program independently of assignments’ in User experience tab of the deployment.

  135. Hi Martin. Thank you for posting this notification solution. This is exactly what I’ve been looking for to use with our current Windows 10 upgrade initiative. One question I have on it… while running this on some test VM’s, I’ve noticed every once in awhile scclient will stop responding. When I look in event logs, it looks like it’s related to .Net. Are you aware if there is a specific .Net requirement for the toast notifications? Other than that I receive the pop up just fine and it looks great. Thank you!

    Reply
    • Hi, sounds strange. I’m simply launching the software center with some allowed and supported parameters, nothing fancy. As if you would launch software center from a command prompt or with a shortcut. No special requirements 🙂

      Reply
  136. is there a way for the to make a custom action button that could open network and connections setting or open available wireless networks.?

    Reply
    • Hey, I don’t think you need a custom action for that. Have you tried running this from run: ms-settings:network-wifisettings

      You can put that into the action button without creating anything custom 🙂

      Reply
  137. Hi All, anyone tried base64 encoding the image files stead of reading from disk? Reason I ask is I’m having an issue where the toast images are not show in the toast notification sometimes, but other times the images show up. I think it might be an issue were users do not have rights to read image file path from the c:\windows\ccmcache\… So I’ve encoded the images but having some challenges getting it to work, because I’m still a noob with powershell. How can I do this using the existing ps1?

    Reply
    • I tried base64 encoding of the images and I didn’t like it. The script is getting huge. fyi, you can host the images online as well. The script accept images coming from a http or https URL.

      Reply
  138. Hi. I’m trying to work with the toast notification, but when I execute the script, it shows me a generic toast notification stating either Powershell or Software Center “New Notification” and doesn’t actually show me the toast modal. Any thoughts on fixing that?

    Reply
    • Have you made any changes to the config? Which config are you loading? What does the log file say (appdata\toastnotification)

      Reply
      • I get the same. but it seems to be when I run it from a network share. \\doamin\netlogon\new-toastnotification.ps1 -config \\domain\netlogon\Config-Toast-rebootpending.xml. Message is just small window that says Software Center.

        If I copy the script local with the config in the network share it works normally: c:\new-toastnotification.ps1 -config \\domain\netlogon\Config-Toast-rebootpending.xml give me the full popup with buttons.

        No changes to any of the files.

        Reply
        • Yep, I’m not completely sure why, but that haven never worked. The config may reside on a network share, but the script is supposed to be stored locally. Either by ConfigMgr in the cmcache or somewhere else 🙂

          Reply
  139. I only need the reboot functionality, is there any way for me to have the restart function work on clicking the action button without having to install the .msi?

    Reply
    • Yes, see my latest version (2.0.x). This version doesn’t require you installing anything, but creates the protocols for you.

      Reply
      • Interesting.

        With version 2.0 I downloaded from github to my machine and ran it. Everything worked fine, but when I tried to deploy through SCCM to another machine it still doesn’t work. I get the same result as I would on a machine that doesn’t have the .msi installed. Any idea why this might be?

        Reply
        • UPDATE:

          It seems the scripts aren’t getting put into the AppData\ToastNotificationScript\Scripts folder when I deploy through SCCM. What could be the cause of this?

          Reply
          • Sounds like you are not running this as the logged on user, but as with administrative rights? This is something you need to fix on the program in the environment tab in configmgr.

          • I’m also seeing this same thing. I updated my Program’s Environment to Run Mode – “Run with user’s rights” and still get the same results.

          • Are you certain that, that change in the program now is reflected in the current policy on the client? What version of the script are you using? Can you paste the relevant content of the log file? For good measures, I just re-tested everything coming from configmgr running with user’s rights, and everything is populated nicely into appdata\roaming\toastnotificationscript. (version 2.0.2 of the script)

          • I’m sure it’s something on my end. Here are the logs –

            2020-09-11 09:26:06 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
            2020-09-11 09:26:06 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-09-11 09:26:06 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
            2020-09-11 09:26:06 ERROR: No config file found on the specified location [locally or fileshare]

            Could it be an issue with the way I’m deploying the package?

            On Deployment options –
            “Download content from distribution point and run locally” or should I select “Run program from DP” ?

          • How are you specifying the config.xml file if any? Where is your config.xml located? The script accepts the parameter -config, that accepts both UNC paths as well as files hosted online (http or https). If no config file is set via the parameter, the script assumes that a config file is stored next to the new-toastnotification.ps1 file. 🙂

          • I’m using the 2.0.2 Script…this is the script I’m running in the package. That package is point to a file location with the required files.

            powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File .\New-ToastNotification.ps1 -Config “\\Server\SourceFiles\Toast_Notifications\ToastNotificationScript2.0.2\config-toastpendingreboot.xml”

            So maybe my cmd line is wrong?

          • Does the user running the script have access to that location? The cmdline seems OK, the script just doesn’t get to read the config file and that’s where your troubles are. Can you verify that there’s access to the path and that the config.xml indeed is located there?

        • First, wanted to say thanks for the help Martin!!

          I had the config file named wrong in my cmdfile – “config-toastpendingreboot.xml”
          Should’ve been “config-toast-rebootpending.xml”…guess my brain has already moved onto the weekend.

          Thanks again! Awesome tool!

          Reply
  140. Hi there,
    Love this script. Wondering if there are options for:

    – Prevent user clicking on the body of the toast which will hide the toast box into action center.
    – Count down timer for OS upgrade

    Reply
  141. Do you have an update in progress for maybe a generic message sender? I’d like to send a system notification, like planned maintenance is about to start? I can kind of hack up the XML file to make it do something similar but if you have something planned, that would be cool.

    Reply
    • If you are referring to use the script to send out general notifications, you can do that by simply turning off all the features in the xml. If you do that, the notification will work like that. The message configured in the xml will be sent out to the devices.

      Reply
  142. Nick kind of hijacked my questions so I’m going to continue on a new thread here because we are not having the same issue and the reply option is gone on the original post.

    My config file is read perfectly fine, it displays whatever I type in the text portion and it does what I ask. My program is run at the user level and not the admin level. My problem is that the script will create the ToastNotificationScript file in %appdata% but it wont put any scripts inside the folder so when I click the “Restart Now” button there is no script to be run. The way I’m implementing this is by SCCM copying the entire folder onto the user machine using robocopy and then running the script locally.

    Thanks again for all the hard work!

    Reply
    • Can I get you to check the registry in HKCU\Software\ToastNotificationScript and the value of the ScriptAndProtocols registry entry? Scripts and protocols are only created if the value of said registry entry is less than the script version. I do this to only create stuff if really needed. Though if the registry entry got created in your end, but not the scripts, running the script again will not make a difference, as long as the registry key is there. Also, can I get you to paste the relevant content of the log file?

      Reply
      • Hey Korey, sorry about. Now that I look at it my Scripts folder is also empty. My registry value is 2.0.2

        2020-09-11 11:41:27 INFO: Script version: 2.0.2 matches value of ScriptsAndProtocolsVersion in registry. Not creating custom scripts and protocols

        Reply
      • Martin,

        I’m not really sure why, but this morning I started working on it and it just decided to play nice. Everything is working properly at the moment. I am happy that it works, a little uneasy because I don’t know the exact problem I was having, but I’ll just monitor it closely and if I discover anything I’ll try to post it here for anyone else to see.

        Your work and dedication to this script is awesome!
        Thanks a bunch!

        Reply
        • Thanks! Don’t hesitate to reach out. I’m very keen on getting rid of any bugs I might have introduced. I can only do so much testing myself and I’m usually blind in that regard.

          Reply
  143. Hi Martin,

    Awesome Stuff !! Thanks for Sharing.

    I tried this in my environment and it works like charm for one Software update. But since we have multiple software updates (available in Software Centre) as a part of our monthly patching. Is it possible to run multiple updates using “Install All” button in Software Centre via this Toast notification ?

    Or it is possible open Updates page in software Centre when user action on Install\Update now?

    Thanks

    Reply
    • Hi Rachna,

      You can send the user’s into the Software Center on the Updates page using this as an action: SoftwareCenter:Page=Updates

      The script is currently not able to enumerate through multiple software updates and install them all. The built in feature to install software updates is mainly targeted for Feature Updates, where there obviously just will be one. 🙂

      Reply
  144. Question about the HeroImage. I added my own image for the ToastLogo and it works but the hero image doesn’t show on my notification. I have the jpg image in the Images folder and referenced correctly in the xml. I have also resized the Hero image to the same size as the ToastHerImageDefault and that didn’t work either.

    Reply
    • Hmm, not sure what to advice. Are you able to share the image with me so I can have a go in my end? I’m not doing anything magically regarding the images, other than just reference them when constructing the actual toast. If not an issue, send me the image at mab@imab.dk and I’ll be happy to have a look.

      Reply
  145. Hi Martin,

    Just a curious question, will there be a way to count how many times user clicks the action or dismiss button on the Toast ? Just to get some idea of user usage / behaviour when toast pop-ups. I know that there’s a task sequence you can run after user clicks the action button but I need that button do something else. What I was thinking is to just have a variable somewhere to keep on increasing the count when a user clicks the action button. Will there be a way?

    -Joan

    Reply
    • Hi Joan, I’m not aware of anything out of the box. It would be easy to implement when using the action button, as you can script anything you like here on top of the actual desired action. As to when interacting with the toast notification in general, there are some information logged into the event log here: Microsoft-Windows-PushNotifications-Platform/Operationa

      Reply
  146. This is great, it does exactly what we want it to do, but I only have one question. I am using osupgrade xml with feature updates specifically 2004, how do i get it so that when i click install it initiates the install from software center?

    Reply
  147. Great Script. I wanted to write for others that might run in a use case where you need to enter a URL protocol that has special characters in it.

    I just figured out how to add ServiceNow KB Article to the toast notification!!!!

    It was a stupid find, but for someone that knows enough XML to get buy I am happy. I have no one to share this with so you have to read.

    The problem is the URL for opening an incident from ITNow or Opening an KB article, there is an & in the URL. That is a special character and needs to be escaped as &

    https://xxx.service-now.com/itnow?id=kb_article&sysparm_article=KB0011111
    which works when done manually, and when the XML file is read into a variable as
    https://xxxx.service-now.com/itnow?id=kb_article&sysparm_article=KB0011111

    However, that variable is read into another XML file that needs the & escaped. The fix is to escape the & twice.
    https://xxx.service-now.com/itnow?id=kb_article&amp;sysparm_article=KB0011111

    I am embarrassed on how long that took me to figure out.

    Dawn

    Reply
  148. Hello
    Some of my machines are not running the script. I noticed in SCCM it states Message ID 10006. Error 1. There are windows 10 1709 or 1809. Can’t figure out why some work and other do not. Nothing in the App discovery or App enforce jump out

    Reply
    • execmgr.log will be the correct log, assuming your are running the script with a package/program. AppDiscovery/AppEnforce are for applications. Error 1 could be me terminating the script for various reasons. Take a peek at the toastnoficiation.log in appdata\toastnotificationscript. What does it say?

      Reply
      • execmgr : Script for Package:WC2005C4, Program: ADpassword expired failed with exit code 1, Toast notification log has not updated for over a month. that is how I found out about 1/3 of the machines were not executing.

        Reply
  149. Your script is fantastic. Got it working in SCCM but when I downloaded the package 2.0.2 I can’t see the msi to enable a reboot. You mention above that it’s not necessary with this version, can you tell me what value I should have here to force a reboot?

    Also I’ve found for Windows Feature Updates a “normal” reboot won’t start the upgrade, it has to be started with “update and reboot” from the Start Menu, is there anyway of duplicating this functionality.

    Reply
    • Correct, the script in version 2.0.2 has an option in the XML which is called CreateCustomScriptsAndProtocols. If this is enabled, the script will create protocols in registry and scripts here: AppData\Roaming\ToastNotificationScript\Scripts.

      The protocol in Windows which enables you to initiate a reboot from the toast action is ToastReoot, but obviously requires that the scripts and protocols are created by the toast script itself:

      Reply
  150. This is looking really fantastic and will definitely implement in our organization. All features are superb, just got a question:
    Our current Windows 10 upgrade notification is checking for the required packages downloaded in ccmcache prior notifying the user for the upgrade.
    Could you please suggest how can we add such configurations in the toast-notification upgrade script?

    Many thanks in advance!

    Reply
    • So all dependencies of the task seqeuence needs to exist by their package id in the ccmcache. That’s not something the script currently can do, but this would be something you could do with collections if precaching content. So once content successfully has precached, you could do a design where the device moves into another collection, where the toast notification is deployed.

      Reply
  151. Hello

    Thank you for responding. It does not seem to execute when I run the command line outside of sccm. I know it works in sccm since I see the logs updating from the previous day when they run around 9am. So some machine it works others it does not.

    powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File .\New-ToastNotification.ps1 -Config “\\server2012\sources\packages\Windows 10 config\Notification-toast\toast-rebootpending.xml”

    Reply
    • Hello, so if trying to run the script locally on one of the affected devices, nothing happens? In either case, something must be reported, either in the log file (if the script manages to pass that point) or directly in the powershell console. What details can you share with me? 🙂

      Reply
  152. Hi,

    Is there a way to enable notification for PowerShell if a user disable that? as I don’t see an option in the script to check for that other than just Notification in general.

    So if I show a notification to user and they hover on the notification, they can select turn off notification for PowerShell and that get disable, I find the registry for it in the HKCU but deleting it doesn’t seems to work and only take affect if you toggle the switch in the actually notification settings.

    Thanks.

    Reply
    • Yes, issue is that, that setting is stored in AppData\Local\Microsoft\Windows\Notifications\wpndatabase.db.

      If a notification hasn’t been sent (since the user disabled it), there’s maybe a (of course not supported) way: stop the service WpnUserService, delete/rename the wpndatabase.db file, delete the regkey “HKCU:Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Powershell” and restart the service again – a new db file is created and afterwards the notification can be sent successfully. Disadvantage of course: most of the notification settings are lost. Basically the old/renamed db file could be written back to get the settings back.

      Reply
      • That would be a pain, cause I have to check for that registry and if it’s exist do those steps to re-create that file and then run it again.

        Is there a way to block the user from disabling notification for PowerShell so it shows up all the time?

        Reply
  153. Hi Martin,
    First of all – thanks for creating this tool, easy to use, easy to change, for people with very few Powershell knowledge.
    However, if I try to use the reboot option, I can see that it’s showing a dropdown button to snooze, but I don’t see the Snooze, reboot action keys.
    I’m using the latest version 2.0.2.
    I have read through the comments already but did not see this noticed before.

    So what have I done so far:
    created an application with 2 files in there:
    – the config-toast-rebootpending.xml file
    – the New-ToastNotification.ps1
    and the images

    the code for the reboot is this.
    Am I missing something here?
































    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:
    Hey you – wake up. Your computer needs to restart. Do it now.
    Restart now
    Dismiss
    Snooze
    Company name
    The IT Organisation kindly reminds you…
    Your computer needs a restart!
    For security and stability reasons, we kindly ask you to restart your computer as soon as possible.
    Restarting your computer on a regular basis ensures a secure and stable Windows. Thank you in advance.
    Click snooze to be reminded again in:
    Your deadline is:
    Good morning
    Good afternoon
    Good evening
    Minutes
    Hour
    Hours
    Computer uptime:
    days

    Thanks!

    Reply
    • Hey, it’s the extra text from the rebootuptimetext option paired with the snooze option, which makes the toast not render properly. I’m preventing that combination in the next version. Either disable snooze or disable rebootuptimetext 🙂

      Reply
      • Thanks for the info and the fast reply! changed it and now I’m able to snooze.
        One more question if I may: is there a possibility to force a reboot after a specific amount of time?

        Reply
        • Only if you script it yourself somewhere. It’s not something my script currently can do 🙂

          You can do another custom action and protocol, that instead of just firing shutdown /r /r 0, you can change it to something else 🙂

          Reply
  154. Martin – This is absolutely fantastic, thank you for sharing! Here’s my scenario and what’s working in my lab..

    1.) Running the Toast Notification application scenario, I wrapped script into PSADT using the following:
    Execute-Process -Path “powershell.exe” -Parameters “-executionpolicy bypass -WindowStyle Hidden -File `”$dirFiles\New-ToastNotification.ps1`” -Config `”\\server\share\public\ToastNotification\config-toast.xml`””

    2.) In SCCM, the program only runs when a user is logged, run mode is set to Run with user’s rights, and program set to always rerun. I use the command line, Deploy-Application.exe Install Noninteractive.

    3.) Toast notification appears and now trying to test the three scenarios, Install Now, Snooze, Dismiss. Not sure what I should be expecting based on how my SCCM program is set to always rerun.

    Reply
    • Hey, the rerun behavior in configmgr doesn’t interact with the buttons in the toast notification. Dismiss will dismiss the current toast notification, period. Snooze will tell the OS to snooze the toast notification for the specified duration. The OS will then display the toast notification once again. The action button will have the action you specify in the config.xml.

      The rerun behavior will simply rerun your PSADT app again, which will run the toast notification. What’s the reason behind wrapping it into PSADT? 🙂

      Reply
  155. Hi Martin, great work! thanks.

    When running Snooze, where is this written to?
    I am deploying a Feature Update via an application. the Toast is set to run every 4 HRS (always rerun), And also setting it to run ASAP. However setting it to run ASAP it will run but as the application isnt yet present in SW center it wont run with a notification to the user.
    Once the machine has the application (feature Update), over two days a user can get duplicate notifications even after snoozing as a previous notification was snoozed.

    Reply
    • Right, when using snooze, you tell the OS to display the toast notification again after the snooze duration, while the rerun behavior in configmgr will do the same. I don’t have a way to prevent that. Personally I don’t recommend using the snooze option, if you also have a rerun behavior in configmgr that rerun the toast that often. 🙂

      Reply
  156. Hello,
    I’m just updated to the latest version of the script and now for some reason I cant get any of the images to show up for the toast notification. Everything else works perfectly fine besides that. I was using version 1.8.0 of the script before and the logo and hero images showed up fine. I’m not sure if anything changed or the images need to be put a specific folder. I left the images in the Images folder like they are by default and checked the config file to make sure the file name was correct for each picture.
    Thanks,
    Kyle

    Reply
    • That’s weird. Does any of the built in images work for you? Does the images show up, if you don’t change any of the configuration in the .xml and simply run the script as it comes from the download, and only replace the images as the only change?

      Reply
      • So the weird thing is the bultin pictures do not show up but if I change the file name to something else and edit the config xml to reflect the change, they show up just fine. Not sure why. At least I was able to get it working that way. Either way, thanks for the script. Truly awesome :).

        Reply
  157. Is there a easy way to replace all SCCM notifications with this? for all new app pushes it looks like you have to hardcode the package ID.

    Reply
  158. I am in the process of testing this for use with Feature Updates. I have both English and German language computers. Would I need to configuration files with different RunUpdateTitle?

    Reply
  159. Hi Martin,

    Great script!.
    How can I get the “Install Now” and “Snooze” action buttons only?
    Editing the xml file “DismissButtion” value to “False” doesn’t work with Snooze enabled.
    The problem is the “Dismiss” button exits the toast notification ever to return.
    If not possible, then how can the Dismiss button be hidden?

    Thanks Tim

    Reply
    • Thanks Tim.

      The script is currently designed in way, where enabling the snooze option, always enables the action and dismiss button, so there’s no option for you within the config file, you will have to modify the actual script to do that 🙂

      Reply
  160. Hi Martin,

    Awesome script!

    I’m not great with .xml but can I add a website link for users to click on in the notification?

    Also we have computers with French OS, will it automatically translate when deployed to the OS?

    Thanks,

    Kyle

    Reply
    • You can specify a website to open in the action button in the .xml. If you want everything to be in French, you need to add an FR language paragraph, similar to the ones I have added for danish and swedish in the config examples I included.

      Reply
          • Hi Martin,

            1. Is there a character limit ?
            2. Just below where is says good morning, it says “Software Center”, is there a way to change it to something else?

          • There might be a character limit. You will know once the toast notification starts to render without buttons and such.
            Software Center is because I use Software Center as the app initiating the toast. It must be something, it can’t be nothing. The alternative is using Powershell. That’s something you can change in the config.xml as well (UseSoftwareCenter or UsePowershell).

          • Hi Martin,

            Thanks again.

            Is it possible to turn off the ability to click or double click the notification and it disappears?

          • Hi Martin,

            Thanks for all your help so far.

            Is there a way to format the information I place in the config.xml? To make it easier to read? Neater?

  161. Hi Martin,

    1. Is it possible to format with etc?

    2. Is it possible to have a 5 second countdown before the buttons are active to click?

    Reply
      • Hi Martin,

        I’m back.

        Question, I’ve asked to find out if the notification can only display when people login and not on the lock screen.

        Reply
          • Hi Martin,

            I read this statement below and wanted to know if you mean I should be going to the “Data Access” tab in the properties of the package and check off “Copy the content in this package to a package share on distribution points”?

            ___________________________________________

            The entire toast notification is configurable through the config-toast.xml. The idea here is, that the purpose of the toast notification can be modified without the need to push new files and/or update distribution points in ConfigMgr.

          • Hi,

            No, what I mean is, that the purpose of the toast notification is something you manage via the config.xml, and the config.xml doesn’t have to be a part of the package in ConfigMgr. So if you decide to change the wording or enable another feature, this is solely done in the config.xml file and the script and package needs no edits. 🙂

          • Oh okay I have a deployment that has the entire package sitting on computers including the config.xml at this time. So I’ve been updating all the DPs. So I edit the config.xml with the change on the PS and then update all the DPs.

            Should I redo the entire package without the config.xml in the package?

          • Your decision 🙂 It’s alright to keep the xml within the package and update DPs as you describe. I just prefer not to. 🙂

          • Yeah, and leave the config files on a file share or upload them somewhere reachable via http(s). I do the latter now, as I don’t what to be dependent on an onprem fileshare. I upload them to blob storage in azure, and reference them via the -config parameter 🙂

  162. Hey Martin, and thanks for the awesome script.
    My question might be a bit odd after having read all the comments here, but I wonder if there is a possibility to scale down the size of the notification?
    I mean I WANT it to be intrusive, so the users get notified (running it as a reminder to restart their computer), but some people thint it’s very big. Especially with the heroimage on top of the actual message.

    I’m guessing it has to do with the templates provided by Microsoft, but I can’t get my head around if there are other templates than “ToastGeneric” to use, and if there are, what they might be called.. 🙂

    Any tips around this?

    Many thanks in advance

    Reply
  163. Hi Martin,

    Once again, thank you for these amazing scripts. Just wanted to ask you, how can i make users to open outlook when they click on the action button defined?

    Reply
  164. Hey Martin, first of all I would like to say that you have built a very useful tool! Thanks for that.

    I have the following problem:

    I use the script for notifying users to install an application. I defined the AppId in the xml as described in documentation.
    The script is scheduled to run at every Login and 9 o’clock every day. My problem is that the notification is also displayed if the application is already installed. Do you have a solution for me? I won’t showing the notification if the software is already installed.

    Thanks!

    Reply
    • Hey, make use of the collections here. Deploy the toast notification script to a collection of devices which doesn’t have said application installed already. Then once the applications gets installed, the devices moves out of the collection and is no longer getting the toast notification. This requires that you run hardware inventory daily, if you run the toast notification daily.

      Reply
  165. Sorry if this was already asked but, is there a way to set a time before the notification is automatically dismissed? I am using it as a reboot reminder and after a weekend or night with the users session locked they will come back having to dismiss 10+ notifications to make it go away. Appreciate any help you can provide.

    Reply
    • Hmm, let me think about this one.

      This usually happens because ConfigMgr has run the program again and again over det weekend. How about not scheduling the script to run during the weekend?

      The toasts are being queued in the action center, and once the first is dismissed, the OS displays the next in line. For now, this seem like an unintended benefit of the behavior with a recurrent schedule and the toast script. 10 toast over the course of a weekend do however seem a bit aggressive.

      You can say, that confimgr and the script simply does what you tells it to do. A toast notification is displayed for each time the script is run with configmgr. I will see if I somehow can avoid this. Let me know what you think about this 🙂

      Reply
  166. Hi Martin,

    Excellent script.

    I tried to use the script, I have updated CreateScriptsAndProtocols as true.

    When i try to execute the script its working fine also I could see .cmd and psi file is creating. but when i click on “Install Now” Nothing is happending.

    Could you please help.

    Reply
        • What do you expect to be happening when clicking the action button? What features within the config.xml do you use? Run task sequence, run application or run package? 🙂 And are any of these deployed to the device?

          Also, paste the entire content of the C:\Users\mab\AppData\Roaming\ToastNotificationScript\New-ToastNotification.log file when answered above questions. 🙂

          Reply
  167. Hi Martin, I had an interesting case where the users machine was off for the past 6 days while he was out of the office over the holiday. When he booted the machine this morning he got the Restart Reminder saying his machine has been up for 25 days. The config file is set to 5 days. The New-ToastNotification.log from this morning reflects the current uptime as 25 days.
    I have the notification deployed with ConfigMgr. I verified that the machine was off in the event logs.
    I’m wondering if this is a timing issue between the PS script running and the ConfigMgr client starting up.
    Thoughts?

    Reply
  168. Hi,

    Scripts are disabled for normal users in our organisation. Is there any way around this by using different permissions etc?

    Thanks

    Reply
  169. First, thanks for the time you’ve spent creating an awesome tool. I can’t tell you how many of my customers integrate this into their MECM worlds to elevate their user experience.
    On to my thought/question…I was asked by a customer about scheduling a daily task to proactively monitor for when new updates are available and present a toast notifying them of that and having the action button launch Software Center on the updates page and initiate the install of all updates prior to the deadline. Currently, at least as far as I can tell, all the logic around updates focuses on an individual update, which of course requires monthly modifications to address them individually.
    I’m not sure if this is something others would find valuable enough to include it in the tool, but in case they would, I’ve written the primary additions needed (staying consistent with the existing scripting approach you’ve taken) to read an additional XML value, query for updates that would be ‘available’, and added the custom registry entries and custom script language for the action button and would like to contribute. I’m still working on the scenario logic that the script currently checks for to find conflicts, but that’s coming. How would I go about sending what I’ve added for you to consider?

    Reply
    • Comments like yours makes it all worth it. Thank you so much for sharing that with me, and in regards to your contribution to the script, you are more than welcome to send over what you have to my email: mab@imab.dk

      Again, thank you so much! 🙂

      Reply
  170. i run the command : .\New-ToastNotification.ps1 -Config .\config-toast-adpwexpiration.xml but kept getting this

    WARNING: This will always enable both action buttons and the dismiss button
    WARNING: Replacing any previous formatting of the toast xml
    WARNING: Conditions for displaying toast notifications for UpgradeOS are not fulfilled
    WARNING: Conditions for displaying toast notifications for pending reboot uptime are not fulfilled
    WARNING: Conditions for displaying toast notifications for pending reboot registry are not fulfilled
    WARNING: Conditions for displaying toast notifications for pending reboot WMI are not fulfilled
    WARNING: Conditions for displaying toast notification for ADPasswordExpiration are not fulfilled
    WARNING: Conditions for displaying default toast notification are not fulfilled

    Reply
    • you left out some of the important parts of the log file, saying something about if you have a password expiring within the defined period. If your password is not expiring, the toast will not display 🙂

      Reply
  171. Kudos for the work done here “Windows 10 Toast Notification Script”
    im using the script for os upgrade – when i press the action button to trigger the process runnning the ts
    I get a cmd prompt shortly showing the cmd file created by Write-CustomActionScript i think
    should this cmd not be hidden? or maybe put @echo off so the code executed in the bat/cmd is hidden from the userr

    and again nice work.

    Reply
    • In the nature of cmd being a console application, it cannot be hidden without calling cmd from something like a .vbs script. I did initially consider it, but again, you are clicking and initiating an action, and a short cmd prompt doesn’t bother me much. I’d understand if you’re running something silent for the user, but in this case, the user are aware of an action being initiated.

      Perhaps in the future, I’ll rewrite the custom actions to be initiated silently.

      Thank you 🙂

      Reply
      • did some modification so fit my need line:983
        Now i only get the cmd box without path to the ps1 file maybe add echo “Running Action…”

        [String]$Script = @”
        @echo off
        powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File `”$global:CustomScriptsPath\ToastRunPackageID.ps1`”
        “@
        #”powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File `”$global:CustomScriptsPath\ToastRunPackageID.ps1`””

        Reply
  172. Working with the reboot notifications. Some users are getting the following error when the hit RestartNow:

    You’ll need a new app to open the toastreboot

    Any ideas? And can we get the system to log what happens when the buttons are hit?

    Reply
    • Do the users have any content in this folder: C:\Users\Martin\AppData\Roaming\ToastNotificationScript\Scripts
      What version of the script is being used?
      What if configured as action in the config.xml?
      In registry for those users, try to delete this registry entry: Computer\HKEY_CURRENT_USER\Software\ToastNotificationScript\CustomScriptandProtocols and rerun the script. Does the action button work?

      Reply
      • Sorry for very late reply. I am still in testing, so very few users to work with.
        + Verified that the affected user does not have any content in the Scripts folder.
        + Running v2.0.2
        + I am running 2 deployments with different config files. One for check pending reboot and one for time since last reboot. It is working from SCCM on some machines, not others.
        + There is nothing in HKEY_CURRENT_USER\Software\ToastNotificationScript. I had the user delete the ToastNotificationScript key, but that did not have any affect when it was reran.
        + The action button does not work. It gets the error I mentioned.

        Additionally, I found that none of these keys are getting created:
        • HKEY_CURRENT_USER\Software\Classes\ToastReboot
        • HKEY_CURRENT_USER\Software\Classes\ToastRunApplicationID
        • HKEY_CURRENT_USER\Software\Classes\ToastRunPackageID
        • HKEY_CURRENT_USER\Software\Classes\ToastRunUpdateID

        Reply
        • Hmm, does it work when running the script manually on those devices? What if you take my latest version 2.1.0. Does that make a difference?

          Reply
  173. Hey there,

    I have created my own script for a toast notification. I was trying to find a way to re enable toast notifications if it was disabled by the user. Your script does that with the pushnotification registry key. But here is the problem, if I follow the way you do it even after restarting the WpnUserService, the toast notification will not show up. Does it have to do with the windows version (2009) that I am using?

    Reply
    • I am having the same issue. Except I have the audio part turned on, so that still works but the toast message doesn’t pop up. The only way I have found to fix that is to manually toggle the notifications off and on. There has to be something else we can do to force the toast messages to reactivate and pop up.

      Reply
  174. Bringing in the 2.1 version from 1.6, as there’s some grumbling about the password expiration piece still coming up after the password has expired (and they claim they rebooted). Seems there was a change to direct file paths for images, as was pointing to a logo file (C:\ProgramData\CompanyAssets\logo.bmp), and that no longer works.

    Still a great tool, we’ve had a lot of positive feedback, even if users grumble “do I have to change my password now?”

    Reply
  175. In the instructions, It says to input the UNC path for the XML file if stored remotely. I cannot for the life of me figure out where to insert the UNC path for the xml files in the PowerShell script.

    Reply
  176. Hi Martin,

    When using the notification script with the RunApplicationID parameter, does it check the installation state of the application before displaying the notification? Like if the app is already installed, it doesn’t display the notification.

    Reply
    • Hey Michael, you shared this suggestion on GitHub as well. Currently it does not check if the app is actuall installed, though it checks if it’s deployed to the device. Appreciate the suggestions – thank you 🙂

      Reply
      • Hi Martin,

        Did I really shared this suggestion? I don’t even remember. Well, I guess I will try to exercise my memory a bit more before asking new questions. 😅

        And if I find some time for that, I will work on adding this feature and make a PR once it’s ready.

        Reply
        • Hi,

          is there any news on implementing this feature?

          This would be really helpfull in avoiding useless pop-ups and improving the customer experience.

          regards

          Reply
          • I need the same functionality so I did this really quick workaround. Add this from line 660:

            try {
            $TestApplicationIDState = (Get-CimInstance -ClassName CCM_Application -Namespace root\ccm\clientsdk | Where-Object {$_.Id -eq $RunApplicationIDValue}).InstallState
            }
            catch {
            Write-Log -Level Error -Message “Failed to retrieve $RunApplicationIDValue InstallState from WMI”
            }
            #If Application ID State is installed then exit
            if ($TestApplicationIDState = ‘Installed’) {
            Write-Log -Level Error -Message “Script will exit here. Application is already installed”
            Exit 1111
            }

            did not test too much, use at your own risk 🙂

    • I don’t think that’s possible. The body text itself cannot be interactive and the only actions lies within the action buttons I’m afraid.

      Reply
  177. Great work,

    Two suggestions:
    – to show notification under system account serviceui.exe (Part of mdt) could be used I think
    – add support for multiple sccm app installation (if I run second notification for installing another app, registry key with app ID will be replaced right? So the first notification “stops” working. So maybe add some ID param to store settings and custom actions in different location

    Reply
  178. Hei Martin,

    Thanks for the script, nice work!
    One question, I get : waring : conditions for displaying toast notifications for upgradeOS are not fulfilled.

    How can I see whats the problem her, everything seems to be inplace…..

    Mvh John

    Reply
  179. Hei again Martin,

    Is it also possible to run a OS update ?
    When I add the packages ID from the TaskSequens (which available is in the programvarsenter), nothing is happening.

    I’m missing something here as well ?

    Reply
    • The whole point for the toast notification action, is to run a task sequence directly. What action have you defined in the actionbutton option?

      Reply
    • Have you tried running this manually as yourself, with the user you are logged on to windows. Are the folder in appdata created then? When you create the program/package in configmgr, you need to make sure the program is running with user’s rights in the user’s context

      Reply
    • You can enable a snooze option on the toast notification itself, but if the user clicks Reboot now on the action button, the script behind reboots immediately.

      Reply
  180. Hey Martin

    I implemented one of your earlier versions of the toast notification script and i installed ‘windows 10 toast notification script custom actions’. is this particular application still required to utilise custom protocols or can it be now removed?

    Reply
  181. Hello, I’m testing script locally and it works perfectly.

    After creating a package/program in SCCM (user context with all the suggestion given) i can see throug SCCM log files that the exit code is 0, but unfortunately nothing is displayed and no TostNotification.log is created.

    Can you please help me? I’m struggling with this for hours!!

    Reply
    • I would need some more details from you I believe. I exit the script with 0 if the script is run as SYSTEM, or the config is not available and a few other places.

      Reply
  182. Hello Martin!

    Thanks for this awesome script, I have been using it a lot to install feature updates in organisations.
    I was wondering if it would be possible to make a function for the pending reboot actionbutton that installs updates then shuts down the computer when it is finished? I don’t think that the cmd command shutdown /s installs any pending updates?

    Thanks for the awesome work!

    Reply
  183. HI, I was just wondering what I am missing how do I deploy this to devices via sccm. As when I run it in PowerShell no toast message appears.
    Would really appreciate an idiot guide which runs through how to deploy test etc

    Reply
    • What happens when you run New-ToastNotification.ps1 directly from the download on GitHub? If you do so from a powershell prompt, it would log to the screen for you to see what’s happening exactly. That’s the first place to start in troubleshooting this.

      Reply
  184. Hi Again,
    This is a really great script, and thank you again for all the work.
    I had posted awhile back about the notification showing the wrong amount of uptime. I’ve had a couple users who boot the machine up, and it shows a huge number of uptime in days. Today a machine showed being up for 63 days after the boot up.
    Where is this pulling the uptime from? And how could it be so far off?
    Any help would be appreciated.

    Reply
    • Wow, never heard that before. The uptime is retrieved from WMI: (Get-CimInstance Win32_OperatingSystem).LastBootUpTime

      It then takes the current date (Get-Date) and substracts that from the uptime: Current date – LastBootUptime.

      Perhaps it helps if I use system date formats here. It will use your regional settings to display the date and time for the current date and uptime. Not sure if that can cause any issues if using specific regional settings.

      Reply
      • I does seem really weird. It has occurred on 3 different machines out of about 1800 that this has been deployed to. I was thinking possibly the WMI could be corrupt? Since it has not happened on more machines. Is there some testing I could do that may isolate the issue?

        Reply
        • I would test it manually on the device running that portion of my script which calculates the uptime. Is it persistent? Something rotten must be going on, on those devices.

          Reply
  185. Hello Martin,

    i have question about the burnttoast notification. must the powershell module installed on every devices or can we just deployed from config manager ? kind of regards, Osman

    Reply
  186. Hi

    We have deployed the latest version toast and works fine. If the toast triggers and is ignored with no user interaction and no action buttons used, the toast times out after 10 minutes and disappears. It does not appear in the Win 10 notifications area. It appears it will never trigger again.

    We have set snooze option and that works fine. We have scheduled the deployment via SCCM to rerun at 930A daily if the user dismisses but that also seems to not trigger again.

    Is there a setting that will trigger the toast again if the user ignores and/or dismisses the toast? It would be preferable to configure the toast program rather than running the program on schedule.

    Thank you.

    Reply
    • The snooze option should tell the OS (read this is entirely taken care of by windows itself) to re-display the notification. Other than that, a recurring schedule is needed in order to have the toast to be displayed again if needed. Remember the rerun behavior in configmgr needs to be Always rerun. All of these timings are outside of the scope of the script I’m afraid. This is something the OS does. I just trigger a notification, the rest is left to the OS. 🙂

      Reply
  187. Hi,

    We have created a package as you explained in the documentation but we got an error (exit code 1 in the execmgr, 0x1(1) in Software center).

    This package is configured to run as user rights and the xml file is downloaded together with the ps1, so all the files are in ccmcache.

    If I open a powershell with the same user rights, navigate to that folder and run the same command line, it works well.

    “powershell.exe -ExecutionPolicy Bypass -File .\New-ToastNotification.ps1 -Config .\config-toast-osupgrade.xml”

    Additionally, If I’m logon with an admin account, it works fine using software center.

    It’s pretty weird since I can execute it manually with the same user rights… what else should we check? any thoughts? It seems something is blocking when I’m using SC.

    I’ve tried to search for that folder in programdata as someone else reported here before, but in my case, I don’t have it. This folder always is created in appdata as expected.

    Also, no logs are created when it fails in Software Center.

    Thank you.

    Reply
    • How does your program cmdline looks like? If you keep the .xml wihtin your package, try to rename that to just config-toast.xml and avoid using the -parameter option. Otherwise, use the -parameter option but point to a UNC or online location.

      Reply
      • Hi Martin,

        Thank you, it works by running the ps1 directly without any -parameter option.

        Firstly I used the cmdline as you suggested: “powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden-File .\New-ToastNotification.ps1 -Config myfile.xml” but I got that 0x1(1) error.

        Later I tried to run the powershell directly by using only “New-ToastNotification.ps1 -Config myfile.xml” but I got an error “arguments in original command line .\new toast… doesnt’ match associated command line “C:\windows\syswow64\windowspowershell\v1.0\powershell.exe” -NoLogo -NonInteractive -ExecutionPolicy Bypass” %1″

        Using that one (running ps1 directly) in an application has worked fine but you cannot re-schedule to run every day. I thought to put a detection method to find 20H2 version and let the application deployment cycle to run it every day since the package will fail and will retry the next day… but I would rather to set that program schedule.

        Anyway, finally I used a package without parameters or forcing to use powershell, only executing the ps1 and now it works (it uses the default config-toast.xml as you said).

        I think the root cause in our case was some AV policy because when we open a powershell we got a warning due a constrained mode and I recalled we had other issues in the past.

        Thank you

        Reply
  188. Hello Together, i deployed the Toast Notification as a Package and the TaskSequence with a Deadline to the same Collection. I already reinstalled the SCCM Client on the Device but i do get the Following Error in the LOG: Failed to get deadline date and time from WMI, Please check if there really is a deadline configured, The script is continuing, but the toast is displayed without deadline date and time. The Deadline is visible in Software Center.

    The Full Log File:

    2021-02-16 09:09:12 INFO: ToastNotificationScript registry path not found. Creating it: HKCU:\SOFTWARE\ToastNotificationScript
    2021-02-16 09:09:12 INFO: CustomScriptPath not found. Creating it: C:\Users\User\AppData\Roaming\ToastNotificationScript\Scripts
    2021-02-16 09:09:12 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
    2021-02-16 09:09:12 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
    2021-02-16 09:09:12 INFO: Successfully loaded \\XXX\config-toast_1809.xml
    2021-02-16 09:09:12 INFO: Loading xml content from \\XXX\config-toast_1809.xml into variables
    2021-02-16 09:09:12 INFO: MultiLanguageSupport set to True. Current language culture is de-CH. Checking for language support
    2021-02-16 09:09:12 INFO: Support for the users language culture found, localizing text using de-CH
    2021-02-16 09:09:13 INFO: Successfully loaded xml content from \\XXX\config-toast_1809.xml
    2021-02-16 09:09:13 INFO: CreateScriptsAndProtocols set to True. Will allow creation of scripts and protocols
    2021-02-16 09:09:13 INFO: Registry value of ScriptsAndProtocolsVersion does not match Script version: 2.1.0
    2021-02-16 09:09:13 INFO: Creating scripts and protocols for the logged on user
    2021-02-16 09:09:13 INFO: Running Write-CustomActionRegistry function: ToastReboot
    2021-02-16 09:09:13 INFO: Running Write-CustomActionRegistry function: ToastRunApplicationID
    2021-02-16 09:09:13 INFO: Running Write-CustomActionRegistry function: ToastRunPackageID
    2021-02-16 09:09:13 INFO: Running Write-CustomActionRegistry function: ToastRunUpdateID
    2021-02-16 09:09:13 INFO: Running Write-CustomActionScript function: ToastReboot
    2021-02-16 09:09:13 INFO: Running Write-CustomActionScript function: ToastRunApplicationID
    2021-02-16 09:09:13 INFO: Running Write-CustomActionScript function: ToastRunPackageID
    2021-02-16 09:09:13 INFO: Running Write-CustomActionScript function: ToastRunUpdateID
    2021-02-16 09:09:13 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
    2021-02-16 09:09:13 INFO: Running Write-PackageIDRegistry function
    2021-02-16 09:09:15 INFO: PackageID: XXX was found in WMI as deployed to the client
    2021-02-16 09:09:15 INFO: Writing the PackageID to registry
    2021-02-16 09:09:15 INFO: DynDeadlineEnabled set to True. Overriding deadline details using date and time from WMI
    2021-02-16 09:09:15 INFO: Running Get-DynamicDeadline function. Trying to get deadline details from WMI and ConfigMgr
    2021-02-16 09:09:15 INFO: RunPackageIDEnabled is True. Trying to get deadline information based on package id
    2021-02-16 09:09:17 INFO: PackageID retrieved. PackageID is: XXX. Now getting deadline date and time
    2021-02-16 09:09:17 ERROR: Failed to get deadline date and time from WMI
    2021-02-16 09:09:18 ERROR: Please check if there really is a deadline configured
    2021-02-16 09:09:18 ERROR: The script is continuing, but the toast is displayed without deadline date and time
    2021-02-16 09:09:18 INFO: Greeting with given name selected. Replacing HeaderText
    2021-02-16 09:09:18 INFO: Greeting with Guten Morgen
    2021-02-16 09:09:18 INFO: Running Get-GivenName function
    2021-02-16 09:09:19 INFO: Given name retrieved from Active Directory: XXX
    2021-02-16 09:09:19 INFO: Creating the xml for no dismiss button
    2021-02-16 09:09:19 INFO: Creating the xml for snooze button
    2021-02-16 09:09:19 WARNING: This will always enable the action button as well as the dismiss button
    2021-02-16 09:09:19 WARNING: Replacing any previous formatting of the toast xml
    2021-02-16 09:09:19 INFO: Toast notification is used in regards to OS upgrade. Taking running OS build into account
    2021-02-16 09:09:19 INFO: All good. Toast notification was displayed
    2021-02-16 09:23:24 INFO: Running supported version of Windows. Windows 10 and workstation OS detected
    2021-02-16 09:23:24 INFO: Specified config file seems hosted [locally or fileshare]. Treating it accordingly
    2021-02-16 09:23:24 INFO: Successfully loaded \\XXX\config-toast_1809.xml
    2021-02-16 09:23:24 INFO: Loading xml content from \\XXX\config-toast_1809.xml into variables
    2021-02-16 09:23:24 INFO: MultiLanguageSupport set to True. Current language culture is de-CH. Checking for language support
    2021-02-16 09:23:24 INFO: Support for the users language culture found, localizing text using de-CH
    2021-02-16 09:23:24 INFO: Successfully loaded xml content from \\XXX\config-toast_1809.xml
    2021-02-16 09:23:24 INFO: CreateScriptsAndProtocols set to True. Will allow creation of scripts and protocols
    2021-02-16 09:23:24 INFO: Script version: 2.1.0 matches value of ScriptsAndProtocolsVersion in registry. Not creating custom scripts and protocols
    2021-02-16 09:23:24 INFO: RunPackageID set to True. Will allow execution of PackageID directly from the toast action button
    2021-02-16 09:23:24 INFO: Running Write-PackageIDRegistry function
    2021-02-16 09:23:25 INFO: PackageID: XXX was found in WMI as deployed to the client
    2021-02-16 09:23:25 INFO: Writing the PackageID to registry
    2021-02-16 09:23:25 INFO: DynDeadlineEnabled set to True. Overriding deadline details using date and time from WMI
    2021-02-16 09:23:25 INFO: Running Get-DynamicDeadline function. Trying to get deadline details from WMI and ConfigMgr
    2021-02-16 09:23:26 INFO: RunPackageIDEnabled is True. Trying to get deadline information based on package id
    2021-02-16 09:23:27 INFO: PackageID retrieved. PackageID is: XXX. Now getting deadline date and time
    2021-02-16 09:23:27 ERROR: Failed to get deadline date and time from WMI
    2021-02-16 09:23:27 ERROR: Please check if there really is a deadline configured
    2021-02-16 09:23:27 ERROR: The script is continuing, but the toast is displayed without deadline date and time
    2021-02-16 09:23:27 INFO: Greeting with given name selected. Replacing HeaderText
    2021-02-16 09:23:27 INFO: Greeting with Guten Morgen
    2021-02-16 09:23:27 INFO: Running Get-GivenName function
    2021-02-16 09:23:27 INFO: Given name retrieved from Active Directory: XXXX
    2021-02-16 09:23:27 INFO: Creating the xml for no dismiss button
    2021-02-16 09:23:27 INFO: Creating the xml for snooze button
    2021-02-16 09:23:27 WARNING: This will always enable the action button as well as the dismiss button
    2021-02-16 09:23:27 WARNING: Replacing any previous formatting of the toast xml
    2021-02-16 09:23:27 INFO: Toast notification is used in regards to OS upgrade. Taking running OS build into account
    2021-02-16 09:23:27 INFO: All good. Toast notification was displayed

    Reply
    • See my latest reply. The deadline is grabbed from WMI as the user via Get-CimInstance -Namespace root\ccm\clientsdk -Query “SELECT * FROM CCM_Program where PackageID = ‘packageid'”. If this is run manually on the device, do you then see a deadline configured?

      Reply
      • So I am seeing the same issue that PackageID was not found in WMI as deployed to the client. But I am seeing the Win10 IPU task sequence in the software center. I have verified the PackageID. When I run that command above, it doesn’t find it. Is something wrong with WMI? Is there a way to fix this?

        Reply
  189. Hello Together,

    i found that the dynamic Deadline in the Toastnotification Script for an InPlace Task Sequence ist not working if in the Properties of an InPlace Task Sequence under Advanced: “Suppress task sequence notifications” is set or enabled. I do wan’t to use the Notification Tool instead of any Task Sequence Notifications. In the Log the following Error is reported: Failed to get deadline date and time from WMI, Please check if there really is a deadline configured, The script is continuing, but the toast is displayed without deadline date and time. If “Suppress task sequence notifications” is disabled it works very well and displays the dynamic Deadline. Does anyone have an idea how to fix this error?

    Best regards,
    snoogarp

    Reply
    • Hm, the toast notification grabs what it’s able to retrieve from WMI as the user. I believe this will require that the task sequence is visible in the SC and ‘allow the user to run the program independently of assignments’ enabled on the experience tab of the deployment of the TS (suppressing notifications shouldnt matter in this case)

      Reply
  190. Hi, thanks for the great script!

    Just wanted to ask, is there a reason I shouldn’t amend the code so that I can have 3 buttons:
    (1)Action 1 – install package, (2) Snooze and (3) Learn More – MS Edge to webpage

    I’m using your script for an OS Upgrade and ideally wanted our users to install now, snooze – to install later, or Learn More taking them to an intranet page about relevant information.

    Obviously, your script prevents 2 actions and snooze being enabled at the same time, so I’ve managed to amend the ps1 to work for what I need by commenting out this small bit of error-handling. But before I start using it with our users thought I would ask the question?
    Thanks again.

    Reply
  191. Good morning @ all.

    First of all, very nice Tool!

    I have 2 Questions:
    1. I created the Package and a program. I deployed the program to a device group within SCCM. Run Mode “Run with user’s rights”, only when a user is logged on. Advanced Setting “Run once for every user who logs on”
    Test result was negative, no notification when users log in.
    2. I tried to test the script directly with powershell. -> .\New-ToastNotification.ps1 -Config .\config-toast.xml
    Script is working, but i do not see the notification layout wich you posted above. I only see a small popup Notification like Softwarecenter New Notification.
    Thanks for your Support

    Reply
  192. Hi Martin,

    Not sure if I’m missing something, I’ve downloaded 2.1.0 version and all the config files are not in English.
    Do you have English version by any chance?

    Reply