UPDATE: The script used here has been severely updated: https://www.imab.dk/windows-10-toast-notification-script/. The scenario described here is still relevant though, so I recommend that you still read through this 🙂
This will be a small but exciting contribution to my ‘Windows as a Service’ series!
The usual story here is, that everyone wants to add more user-friendliness to the whole experience around Windows Servicing.
End-users generally doesn’t care about new versions of Windows and they also, generally speaking, find interruptions in their work annoying, especially if those interruptions come unexpected.
So we come up with clever solutions to solve those problems and this will be an addition to that; remind the user with a big nice Windows toast notification when a Windows upgrade is pending. This is for the obvious reminder, but also to lure the end-user into a voluntary participation.
Find some of my previous WaaS posts here:
Part 1: https://www.imab.dk/windows-as-a-service-sharing-my-precache-and-in-place-upgrade-task-sequences-part-1/
Part 2: https://www.imab.dk/windows-as-a-service-sharing-my-precache-and-in-place-upgrade-task-sequences-part-2/
What Is This?
What is this and how does it work? I’m not the first person to advocate for the use of the toast mechanism in Windows 10 and I’m most certainly not the last.
Trevor Jones at https://smsagent.blog/ has again created something inspiring, as well as the guys behind https://automationsynd.github.io/. Both solutions involves using toast notifications in Windows 10 with SCCM.
Needles to say, I also ended up feeling the urge and put something together which I’m using in my own WaaS setup. The effect of the toast is astonishing. I will elaborate later.
This is the delicious magic. Download the script and open it with your favorite ISE and study it. I will elaborate where necessary in the next section.
IMPORTANT NOTE: The script is tailored to a requirement of having the SCCM client installed. This is the entry in the registry around which app (Read: Software Center) that is doing the notification. If you don’t have the SCCM client installed, the toast won’t display! Alternatively, use something else. I have included an alternative app in the end of the script for uses on devices without a SCCM client.
Run The Script
Simply running above script as is, will yield below result. So far so good. The text is obviously customized by myself and for my needs. The reference to Yammer is for internal use.
Also, I’m afraid the picture I’m using here and which is included in the script as a base64 string is protected by copyright (it’s a paid picture), so I’m kind of preventing you from using it with an annoying watermark. Sorry 🙂
When hitting ‘Install now’, Software Center is launched opening an application, which again is launching the Task Sequence. This is something I have covered in a previous post here, on how to use Powershell App Deployment Toolkit to upgrade Windows 10: https://www.imab.dk/how-can-i-in-place-upgrade-to-windows-10-1803-using-powershell-app-deployment-toolkit-and-sccm-system-center-configuration-manager-part-2/
Note: Stating the obvious, I’m using Powershell App Deployment for recognizability AND some additional user-friendliness.
Software Center is launched because of this line in the script:
# Application in Software Center running the task sequence
$Application = "softwarecenter:SoftwareID=ScopeId_A9117680-D054-482B-BC97-532E6CBD0E6B/Application_4920c244-5b1e-4434-9117-fded57f5c80f"
Where the ID is obtained in the Software Center following the instructions outlined in below illustration:
Image Used In The Toast
The base64 string for the image is generated using below Powershell. This is directly copied from Trevor Jones: https://smsagent.blog/
Note: The image used here in my toast is 360*150 pixels.
# Convert an image file to base64 string
$File = "C:\Temp\News_imab.jpg"
$Image = [System.Drawing.Image]::FromFile($File)
$MemoryStream = New-Object System.IO.MemoryStream
[System.Byte]$Bytes = $MemoryStream.ToArray()
$Base64 = [System.Convert]::ToBase64String($Bytes)
$Base64 | out-file "C:\Temp\News_imab.txt"
More Toast Options
I’ve included some more options in the Powershell script in the very end: Deadline information and snooze action.
<# Deadline information. Add this into the toast XML for additional information about upcoming deadline
<text hint-style="base" hint-align="left">Your deadline:</text>
<text hint-style="caption" hint-align="left">$(Get-Date -Date $Deadline -Format "dd MMMM yyy HH:mm")</text>
<# Snooze action. Copy this into the toast XML for added snooze functionality
<input id="snoozeTime" type="selection" title="Click Snooze to be reminded in:" defaultInput="15">
<selection id="15" content="15 minutes"/>
<selection id="60" content="1 hour"/>
<selection id="240" content="4 hours"/>
<selection id="480" content="8 hours"/>
<action activationType="protocol" arguments="$Application" content="Install now" />
<action activationType="system" arguments="snooze" hint-inputId="snoozeTime" content=""/>
<action activationType="system" arguments="dismiss" content="Not now"/>
Deadline is obviously meant to be aligned with a required deployment in SCCM. The snooze option is self-explanatory, though not something I intent to use. If you enable these “features”, the toast will look similar to the example below.
Putting It All To Use
The use case here is all based on my own environment and the way I do Windows Servicing. I’m using the Powershell script creating the toast in a old school package in SCCM. The few details are as following:
- Save the New-ToastNotification.ps1 onto your source file library
- Create a package with source files containing the Powershell script
- Create a Program running the Powershell script in USER context
- Command line: powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File .\New-ToastNotification.ps1
Here are some screenshots of that process for your convenience, though it’s very basic SCCM:
The toast notification is only relevant for computers/users who haven’t run the IPU already, but also computers where all of our Pre-Checks has passed and thus the same collection as we use for deploying the actual IPU TS.
EXCLUDING the collection, where the upgrade has completed (we don’t want to remind users about an installation they already completed):
Run the toast notification on a schedule. For example every day at noon or whatever suits your needs:
These numbers are astonishing. The deployment of the Windows upgrade is so far only made AVAILABLE and thus, all of these succeeded upgrades are due to voluntary user participation after 1 day.
Now, this environment is still based on a mid-size company in Denmark, and I only manage 1000 (one thousand) devices roughly, but 18% user-participation is 18% – regardless of the size.