Introduction
It’s been a while since the last update on this script. I admit that. Better late than never, I guess.
This update brings a slight improvement to the looks of the toast notifications, and (almost) definitely removes the option for the end-user to disable the notifications as well.
Also, I was wondering about naming the script differently. The script surely works with Windows 11 too, but seeing the entire toast framework was introduced with Windows 10, and Windows 11 behind the scenes is still appearing as version 10.0, I will stick with the current name.
Whatβs New
- 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
Config.xml
The addition of the new option to create a custom notification app, requires you to update your existing config.xml files. The changes to the config.xml file is highlighted below, and the results are shown in the picture above.
Register-CustomNotificationApp
The magic lies within this function in the script. Bits and pieces are borrowed from Mr. Trevor Jones @ https://smsagent.blog.
What I do differently, is to write the details into HKCU, so the script – once running in user context – is able to write to the relevant area of registry.
I also add an icon to the notification app, which in this scenario is a small cogwheel. See the header-image for the exact illustration.
Prevention of disabling Toast Notifications
The (almost) definitely prevention from disabling the toast notifications, comes from the ‘ShowInSettings’ DWORD value in registry. Almost because this is written to HKCU, and users with knowledge of registry, can obviously modify this themselves.
This is the area of registry, which the script creates automatically for you, based on the content of the config.xml.
Download
Download everything fromΒ GitHubΒ here:Β https://github.com/imabdk/Toast-Notification-Script
If any questions, please leave them down below and I am happy to assist with any issues.
ENJOY π
Hi,
Thanks for that, will give a try, but i cannot download from github, it says that i don’t have permissions π
thx
Sorry, all is good now, the issue was on Edge Side π
thx
No worries. Let me know if anything is not working for you π
Martin, thank you for great work.
I was wondering why other xml config files have both UseSoftwareCenterApp and CustomNotificationApp set to ‘True’
I am trying to run some configs manual to test and getting an error:
Error. You can’t have both SoftwareCenter app set to True AND CustomNotificationApp set to True at the same time. Check your config
I can run the script if i change SoftwareCenter to False.
Can and should i have both set to true when running from SCCM?
Thank you.
Right, that just me forgetting to reset those values back to False. Ideally and with the new version, you set both Software Center and PowerShell to False, and configure CustomNotificationApp to True and with the desired value. π
Hi,
Is there a manual on how to create the custom notifications as this is all new for me π
The script does that for you. Simply enable CustomNotificationApp in the config.xml and set the desired name π
Hi Martin, at the beginning thank you so much for this amazing work. I want to ask because I did not test your script yet, can the scrip allow us to change the logo to the company logo? Can we add more than one portion to the user for restart like , 1 hour, 2 , etc. ? Finally can we custom the message to meet the app or the deployment we use it for?
Yes, everything can be customized the way you want it π
Hi Martin, first of all, a big thank you for this! Would there be a way to get some kind “confirmation message/button” after user press “Install” (OS Upgrade)? Like: “Have you saved all your work before continuing? Press “yes” to continue OS Upgrade”. Thank you.
Yeah, you can leverage PowerShell App Deployment Toolkit to add even further user-friendliness to the process. I have a blog post covering that as well. So instead of launching the OS directly on the install button, the install button launches PSADT that have that extra confirmation you seek. Search for PowerShell App Deployment Toolkit on my blog π
Has anyone had luck pushing this via proactive remediations through Intune?
Yes, I have a blog post walking through that scenario as well. Search for Proactive Remediations π
Hi Martin, first of all, a big thanks for your efforts, this is amazing work. for some reason when I try to test it by removing your website from the Toast notification, through some errors, also, can I change the time and give the user an option to snooze it if they are in the middle of something?
Please advise
Thanks,
Matt
Hey Matt, what errors do you receive when and where? π
Hi Martin –
I am getting the toast notifications but I am iMAB.DK NOTIFICATIONS and that I have a new notification, no hero images or additional text. Any thought?
Have you made any changes to the config.xml you are using? Run the New-ToastNotification.ps1 directly from the download, without changing anything in any config.xml. verify this works and make changes from there. The log file in appdata\ToastNotificationScript is helpful to paste here too.
Hi Martin
first of all – thx for the amazing script. you should get an award for it π
1 recommendation. can you add in your github maybe following line that every new “customer” can benefit of seeing which user as executed the notification.ps1. here are my code adaptions:
function Test-NTSystem() {
$currentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
if ($currentUser.IsSystem -eq $true) {
Write-Log -Message “Script is initially running in SYSTEM context. Please be vary, that this has limitations and may not work!”
$true
}
elseif ($currentUser.IsSystem -eq $false) {
$currentUserName=$currentUser.Name
Write-Log -Message “Script is initially running in USER context – $currentUserName”
$false
}
}
the your logfiles will also contain the user who has executed it like this..
2022-02-02 15:05:18 INFO: Script is initially running in USER context – DomainHeros\TonyStark
2nd and quite more important for me… i do have an issue where i am abit frustrated yet.
when i execute the command lines in an user context running powershell ISE i can see the Toast but when i am running the same staff as scheduled task etc i can see the success execution within the logfile but there is no toast notification visible on the win10 users host.. any ideas? the funny stuff, i can also execute it in MEMCM as package but not in a way that i can use it in emergency cases etc direct via scripting… remote sessions etc…
pls get in contact with me. it seems to be that i am a noob in this case π
Hey, thank you for your suggestion. I’ll add that into a future release.
In regards to your obstacles with a scheduled task. Have you had a look on my (very limited, I know) documentation included in the download? There are clear instructions on how to get this to work with a scheduled task.
Also, the script is confirmed to work with applications, packages/programs and task sequences in ConfigMgr. It does not work with the Run Script feature π
Hi Martin,
Thank you for this amazing work.
I am working on it to test if I can use it to upgrade from 1909 to 21H2.
And most part seems ok so far but I have got a problem when comes to the toast notification.
I have created a script to create the Task scheduling so that every time a user logon, it triggers a popup.
I integrate the package to my SCCM and downloaded to my VM.
Yes, task scheduling is created but the popup is not working.
I took my script and created the task scheduling by running the script manually and toast notificaiton is working because when I run m it manually, it runs as user.
I see above oyu mention in your documention but you didn’t mention where to get it.
can you help please on this?
Much appreciate
Hi Martins.
First of all thanks for this script.
I would like to know if there is any way of testing the OSUpgrade toast without the upgrade available.
I wanted to customize it and see it before applied in out environment. Can you help?
Thanks.
Yeah, you simply have disable the various options in the .xml, so you revert to displaying a default toast notification. With that, you can verify the looks of the toast before using in production. I encourage you to atleast deploy the new OS to yourself or test devices, to test the complete flow.
Hi Martin,
Thanks for the amazing script π
Is there a way to add a countdown time for the restart function and at the end of the countdown to actually restart the PC ?
Thanks,
Iulian
Thank you. Only if you make something yourself. Should be doable with PowerShell, but it’s not something that’s built in. π
Hi Martin
Thank you for the great work, I just have question regarding the script of Register-CustomNotificationApp, after run this script, I suppose to see my app show in the Notifications & Actions in Windows 10 Settings?
Thanks
No, the notification app will not be visible in the UI, but you can use it in your toast notification script config.xml π
Thank you for quick response, but in the original blog from Mr. Trevor Jones, he mentioned “The ShowInSettings parameter determines whether the app can be seen in Settings where the user can turn notifications on or off for the app.”, so what’s the difference here?
Thanks
Hello All,
I am unable to use toast Notifications script for Wondows 10 21H2 update
Hello All,
I am using the script via Task Schedular the problem is with Windows 10 20H2 patch where I an unable to use the toast notifications for unsupported Apps.
Great script. I do have a question in regards to rebooting. I have been tasked to ensure systems are rebooted weekly but I want to give the users warnings and such but also force it if they don’t follow through. Would it be possible to add a deadline for a reboot and if the user does not reboot it can it be forced on them? Would it be best to call an app\package? Thanks!
Then you will have to extend the script, to create a scheduled task for you instead. Currently, the only action the script has in that regard, is to run shutdown. Hence you will need to build something on your own π
@Martin Bengtsson
amazing Script iam searching for so long for a Toastscript that workd !
great job !!
is it possible to start a batchfile from a action button ?
thx alot !
@martin Bengtsson
amazing work ! finally i found a toast-script that worked !!
Great Job !!!
One question, is it possible to start a batch-file from a action button ?
Hi,
Marvelous script. I’ll use it for alert users every Friday, about the 5 days unrestarted computer π
For me adpw is not ok, i have the ccmexec error message.
Question: Do you know the code to have a custom script to toast when VPN connection is disconnected?
martin, fantastic scrip. I really help me out. I do have one question. I keep getting a restart is necessary even though i have restarted the system several times in a row. Suggestions?
yeah, disable the PendingRebootCheck option in the config.xml and just rely on the uptime instead. π
Hello Martin
Is there any option to use Your script in the scenario where Action button triggers the Win32app installation from Intune?
I have a cloud managed client, no hybrid, no comanagement, no sccm agent. I have an AppX in Intune but I need a Toast notification like Yours with the options Install, Sneeze. The dream is to install AppX from the Toast pressing the Install button.
Hi Martin,
Great script, any chance you could add a message letting the end-user know that their domain account will be expiring in x number of days?
Hi Martin
Is there a way to force a reboot if the system exceeds X number of days past the restart/reboot uptime ?
This script is very helpful
Thanks