Windows 10 Toast Notification Script Update: Personal greeting and protocol based reboot

Introduction

Short and sweet. My Windows 10 Toast Notification Script have received a minor update. Now being at version 1.2. The changes mentioned in details below.

Changes

Personal Greeting

Coming this update, the Windows 10 Toast Notification Script is now able to greet the end user personally by given name, making the toast even more appealing and interesting (hopefully).

The script tries to retrieve the given name from the user in Active Directory. If no Active Directory (or given name) is found, the given name is replaced with colleague: Good evening colleague.

The greeting changes based on time of the day and switches between “Good morning, Good afternoon and Good evening. The personal greeting replaces the HeaderText option in the config.xml file.

Also, there are other means than Active Directory to find a given name (for non-domain joined computers). I’m probably going to add a few more options later on 🙂

ToastReboot Protocol

This is something I have been asked a lot: How can I make the toast initiate the actual reboot. For that I have created a custom protocol called ToastReboot which when used is running shutdown.exe /r /t 0 /d p:0:0 /c “Toast Notification Reboot”. 

It’s not what I consider really pretty, but it works. The toast is limited to protocol based actions thus you have to be creative this way.

The ToastReboot protocol can be installed using the Windows 10 Toast Notification Script Reboot Protocol.msi which is included in the 1.2 download

The installation creates the protocol in the registry HKEY_CLASSES_ROOT\ToastReboot as well as installs a .cmd in ProgramData\ToastNotificationScript

Download

>> https://gallery.technet.microsoft.com/Windows-10-Toast-9f228eb1 <<

32 thoughts on “Windows 10 Toast Notification Script Update: Personal greeting and protocol based reboot”

  1. i still dont get this to work properly.. have no idea why. Everything is okey when i run it manually on my pc, toast shows fine and everything, but when running from sccm as a scheduled task, i get a powershell windows flash, and just a notification bar down in the corner.. the task is running as user with unc path and everything, just dont want to work.

    Log says nothing out of the ordinary and ends with “All good, displaying the toast notification”.

    • How is your program in SCCM configured? Do you have all the images in the same folder for the content in SCCM?

      • Yes. I take the exact same folder and copy it locally, run the script from that location with a -config path to the sccm server unc path, and it runs normally. like this.

        powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File .\New-ToastNotification.ps1 -Config “\\xxxx\Source$\Scripts\Win10.Tools\ToastNotificationScript\PendingReboot\config-toast.xml”

        • That’s exactly how I does it: powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File .\New-ToastNotification.ps1 -Config “\\florida\Applications\Kromann Reumert\Windows 10\ToastNotificationScript\Configs\config-toast-osupgrade-1803.xml”
          Do you have anything in regards to notifications in general configured in your Windows? There are a tons of settings which could interfere with this.

          • i have been thinking about it, but then it would also affect the notification when run manually?

            But all software notifications for Software Center seems normal.

        • And what if you take the default configs I provided in the download without making any changes. Does that change anything?

          • the only thing i changed was the images and text fields, the rest is the same, pendingrebootcheck is True, the other 2 is false..

            There is only 2 options with enviroment, with user rights or administrive rights, and runs with unc name.

            I assume since given name greeting is correct, it is at least manually running as the correct user.

          • It has to run with user rights and only when a user is logged on. yes it’s sounds strange, now that when running it manually it works.

          • Can you try to switch over to using Powershell ass the app doing the notification. Thats also done in the config. Siwtch Software Center to false and set Powershell to True

          • i got the same.. now i says Windows Powershell, new notification instead of “Software Center, new notification.”

            ill just have to find the time one day and try and dig deeper on it.

          • I’m sorry, but that is very weird and must be specific to something in your environment. I have received tons of feedback from people have no issues, so this is new to new. Once you have the reason, will you share it with me? Perhaps I can do something in the script automatically. Thanks 🙂

          • Yes it is weird, but i think i might have figured it out. In your documentation you say that the easiest approach is to run this directly from SCCM using a package. No need to copy any files down locally.

            So i have a package/program made, and on distribution points, i specify run program from distribution point so it doesnt download anything. This is the setting i have used all along.

            If i set deployment to download content and run locally, while still pointing the config file to a UNC path the toast finally shows.

          • Oh! That’s correct. My reference here to no source files, was around the config file. You don’t need to push that to the client and thus keep updating the source files come changes to it. My apologies if that wasn’t clear 🙁

    • Well it works for me in my test env. You may want to install Windows 10 Toast Notification Script Reboot Protocol.msi as well

      $RemoteComputers = Get-Content C:\temp\machinename.txt
      ForEach ($Computer in $RemoteComputers)
      {
      Invoke-Command -computerName $Computer -ScriptBlock {c:\temp\ToastNotificationScript1.4.2\New-ToastNotification.ps1}
      }

  2. For me its not working. I am trying to test in my PC but no luck.
    Not sure what all setting i need to change.Its batter if we have any video or step by step slides which includes where and what to change in order to use this.(Basic document is not helping me)
    i only inform user about reboot is pending after servicing

    powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File “C:\Users\sccmadmin\Desktop\ToastNotificationScript1.2\New-ToastNotification.ps1” -Config “C:\Users\sccmadmin\Desktop\ToastNotificationScript1.2\config-toast-rebootpending.xml”

    • What does the log file say in this scenario? (programdata\toastnotificationscrip). Is the script running as the logged on user? With SCCM or manually?

      • Getting this in log but no popup (testing this manually)

        2019-07-17 12:17:34 INFO: Successfully loaded C:\Users\CM\Downloads\test\config-toast-rebootpending.xml
        2019-07-17 12:17:34 INFO: Loading xml content from C:\Users\CM\Downloads\test\config-toast-rebootpending.xml into variables
        2019-07-17 12:17:34 INFO: Successfully loaded xml content from C:\Users\CM\Downloads\test\config-toast-rebootpending.xml
        2019-07-17 12:17:34 INFO: PendingRebootUptime set to True. Checking for device uptime
        2019-07-17 12:17:34 INFO: Greeting with given name selected. Replacing HeaderText
        2019-07-17 12:17:34 INFO: Running Get-GivenName function
        2019-07-17 12:17:52 INFO: Current security context is not associated with an Active Directory domain or forest..
        2019-07-17 12:17:52 INFO: No given name found. Using placeholder
        2019-07-17 12:17:52 INFO: Creating the xml for displaying both action button and dismiss button

  3. Issues:

    1. User permissions need to change to program data folder so that the log can be written back to.
    2. Same issues as above when running the ps1 from a network share. Have had to move the file locally and configure the SCCM package accordingly.
    3. Is there a way to set the option to force a reboot and not just remove the notification?

  4. Just a quick question.
    How do you run this via SCCM when you have a pending reboot frem e.g. at Software Update deployment?
    If you have a pending reboot in SoftwareCenter from a SoftwareUpdate deployment, further deployments are blocked until you execute the restart.

  5. Same here, scripts unzipped out of the box no modifications, all in c:\temp\

    I run from PS console – no matter elevated or not, local user:
    PS C:\temp\ToastNotificationScript> .\New-ToastNotification.ps1 -Config .\config-toast.xml

    I get this:
    VERBOSE: Successfully loaded .\config-toast.xml
    VERBOSE: Loading xml content from .\config-toast.xml into variables
    VERBOSE: Successfully loaded xml content from .\config-toast.xml
    VERBOSE: PendingRebootUptime set to True. Checking for device uptime
    VERBOSE: Greeting with given name selected. Replacing HeaderText
    VERBOSE: Running Get-GivenName function
    VERBOSE: No given name found. Using placeholder
    VERBOSE: Creating the xml for displaying both action button and dismiss button
    VERBOSE: Toast notification is used in regards to pending reboot. Uptime count is greater than -3
    VERBOSE: All good. Displaying the toast notification

    Nothing displays

    Fresh Windows 10 1903
    Notifications enabled

  6. > Is focus assist enabled?
    It is not enabled all default settings BUT after reboot I see all my previously missing notifications in the notification center and the script seems to be working now (config-toast-osupgrade.xml does not show but I guess this may be related to other settings etc.)
    Nice thing is that the notification stays and wont disappear until clicked, although perhaps that is controlled in xml as well.

    • Glad it’s working 🙂
      > “Nice thing is that the notification stays and wont disappear until clicked, although perhaps that is controlled in xml as well.”
      This is managed in the xml. Take a look at Option Name=”Scenario” Type=”reminder”

  7. Hi,
    I’m trying to implement your script to remind our users to reboot their pc on a regular basis. But when enabling the Snooze button, no buttons at all are shown. The snooze dropdown box are shown.

    Have tried on both Windows 10 1809 and 1903.

    Plz help

    Best regards

    Kim

  8. I’ll try once more:
    I don’t get any buttons when enabling the Snooze Button. I get the Snooze dropdown box, but none of the buttons are visible. What could that be?
    I have tried on both Win10 1809 and 1903.

    Best regards
    Kim Knudsen

  9. Hello,

    I am looking through the provided PDF that comes with the zipped folder and I am not seeing anything that talks about the provided MSI. I was wondering if the preferred method of having the script run on a regular basis is to create a recurring deployment in SCCM or does the MSI setup some sort of scheduling?

    Thanks,
    Brandon Bates

  10. Hello Martin,

    this looks like a great tool, thanks for sharing it!

    I just wanted to inform you, that the “hidden.vbs” Script is considered as Grayware from Trendmicro (Grayware HackTool.VBS.InviBat.A ). I guess we will have to work around that for us, I just thought i should share this information.

    kind regards,

    Philipp Figel

    • Thanks – I have heard that before I think, but never with Windows Defender. The file is harmless though, though it’s intend is to run something hidden 🙂

Leave a Comment

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