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://gallery.technet.microsoft.com/Windows-10-Toast-9f228eb1

7 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?

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

  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…

    • What, another appid? Interesting. What does that return in your end? It’s a great idea – thanks for sharing 🙂

  3. In my case it looked something like this:

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

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

Leave a Comment

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