Windows 10 Toast Notification Script Update: Retrieve task sequence deadline dynamically from WMI

Introduction

Another neat update to the Windows 10 Toast Notification Script is a reality. Now being on version 1.4.4.

The new version brings a new deadline option, that when enabled, will look in WMI for the specified task sequence package id, and retrieve the deadline of the required deployment dynamically.

This time a thank you goes out to @kevmjohnston for contributing with idea and bits of code. 🙂

What’s new and delicious are mentioned in details below.

What’s New

  • 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 permission 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

Config.xml

The option to retrieve the deadline date directly from WMI is highlighted in below illustration.

To enable the option, simply configure DynamicDeadline to Enabled=”True” and specify the Package ID of the task sequence in the Value field: Value=”KR1008C8″

Using the new DynamicDeadline option, overrides the previous Deadline option. Also, having both enabled and set to True will give a conflict when the script is run.

Configuration Manager

The Package ID of the task sequence can be found in the Configuration Manager console when browsing your task sequences. See below illustration:

And the required deployment, which in this instance is scheduled for december 24th, 11:34AM (Non-UTC), is automatically and dynamically displayed in the toast notification.

Download

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

10 thoughts on “Windows 10 Toast Notification Script Update: Retrieve task sequence deadline dynamically from WMI”

  1. I’ve been doing something similar to the dynamic deadline check for some time but not using this method. This is much cleaner but I do see an issue in my environment. The deadline that is pulled back from WMI is EST -5 for some reason. So if my deadline is 9 PM the deadline from WMI shows 4 PM. Any ideas?

    Reply
    • Yeah, that was it. I missed that one. Thanks for making me aware. If you convert the $Deadline to universal time like so: $Deadline.ToUniversalTime(), the time will display correctly. I have updated the script (version 1.4.4)

      Reply
  2. Wow, I wish I came back earlier. I found the same solution myself and was just now coming back to update you. Thanks for the help again.

    Another issue I ran into is that some of our devices wouldn’t show the toast. Turns out its because the appid used for our software center isn’t the same as what you provide in the script. My plan is to use code like the following to determine the appid on the fly. This code would replace the line “$App = “Microsoft.SoftwareCenter.DesktopToasts”” with the below.

    $App = (Get-StartApps | Where-Object {$_.Name -eq “software center”})[0].AppID

    Let me know your thoughts…

    Reply
  3. In my case it looked something like this:

    Name AppID
    —- —–
    Software Center Microsoft.AutoGenerated.{040C46DB-2B8C-F5A1-4D8A-180D249xxxxx}
    Software Center softwarecenter:

    Reply
    • Duly noted and great knowledge Patrick. Are you sure you haven’t done anything custom to Software Center? Everywhere I check, I get this: Microsoft.SoftwareCenter.DesktopToasts
      Anyway, I will implement that nifty little fail-safe you provided next time around. Thanks again 🙂

      Reply
  4. Hi Martin,
    This is a great solution. I am being asked if we can force a reboot using your toast notification. e.g. Show a countdown for 60 seconds and execute shutdown.exe -r -t 60

    Reply
    • This is not something the script can do natively, but you can create your own custom protocol. Search on my blog for custom reboot protocol for an example 🙂

      Reply
  5. Very appreciative for this intuitive approach utilizing the native toast notifications built into Windows 10. I have made some customizations to work the way we need in our environment, but had a request or question if at all possible. Is there a way to get the actions selected to write to the same log or a new log? Basically want to keep a record of how many people “dismiss” or “restart” right away, or “snooze”. These metrics will help us track a trend in behavior as we look more towards possibly enforcing reboots down the road if people dismiss all the time. Any help or suggestions would be greatly appreciated. Thank you.

    Reply

Leave a Comment

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