Yup. Another Toast Notification post :-) What makes this one unique is how customizable it can be with company branding and links to internal sites, interactive buttons and so on. Once you get the hang of this one you can apply this to multiple scenarios that fit your needs.
- Really need to read Martin Bengtsson blog before you get started. https://www.imab.dk/windows-10-toast-notification-script/
- Download the scripts here https://github.com/imabdk/Toast-Notification-Script
- Edit config-toast.xml to your satisfaction or desired outcome.
- Create a new worklet and associate to the right groups
- Set the Evaluation Code to whatever you want
exit 1
- Set the Remediation Code Payload
# Scheduled Task Name $schdtaskname = 'ToastNotify' # Working Directory $workdir = 'C:\ProgramData\ToastNotify' IF((Test-Path $workdir) -eq $false){mkdir $workdir -Force | Out-Null} IF((Test-Path $workdir\Images) -eq $false){mkdir $workdir\Images -Force | Out-Null} # Cleanup Prior Scheduled tasks if they exist Unregister-ScheduledTask -TaskName "$schdtaskname" -Confirm:$false | Out-Null # Build RunToastHidden.cmd $cmd = @" powershell.exe -NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -File "$workdir\New-ToastNotification.ps1" "@ New-Item -Path "$workdir" -Name "RunToastHidden.cmd" -ItemType "file" -Value $cmd -force | Out-Null # Copy Toast Notify Files $collection = 'ToastLogoImageDefault.jpg','ToastHeroImageDefault.jpg' foreach ($file in $collection){ IF(!(Test-Path $workdir\$file)){ Copy-Item ".\$file" $workdir\Images | out-null } } $collection = 'New-ToastNotification.ps1','config-toast.xml','Hidden.vbs' foreach ($file in $collection){ IF((Get-ChildItem $workdir\$file -ErrorAction SilentlyContinue).LastWriteTime -lt (Get-ChildItem $file).LastWriteTime){ Copy-Item ".\$file" $workdir | out-null } } # Scheduled Task Functions Function Schedule-ToastNotify{ $TaskStartTime = (Get-Date 12pm) $SchedService = New-Object -ComObject Schedule.Service $SchedService.Connect() $Task = $SchedService.NewTask(0) $Task.RegistrationInfo.Description = 'ToastNotify' $Task.Settings.Enabled = $true $Task.Settings.AllowDemandStart = $true $Task.Settings.WakeToRun = $true $trigger = $Task.triggers.Create(1) # https://docs.microsoft.com/en-us/windows/win32/taskschd/triggercollection-create $trigger.StartBoundary = $TaskStartTime.ToString("yyyy-MM-dd'T'HH:mm:ss") $trigger.Enabled = $true $action = $Task.Actions.Create(0) $action.Path = "wscript" $action.Arguments = "`"$workdir\Hidden.vbs`" `"$workdir\RunToastHidden.cmd`"" $taskFolder = $SchedService.GetFolder('\') $taskFolder.RegisterTaskDefinition("$schdtaskname", $Task , 6, 'Users', $null, 4) | out-null } # Running Scheduled Task Function function Run-ToastNotify{ IF($TaskSchd -eq $true){ $time = New-ScheduledTaskTrigger -At (Get-Date).AddSeconds(3) -Once Set-ScheduledTask -TaskName "$schdtaskname" -Trigger $time | Out-Null } } # Schedule and Run the Scheduled Task Schedule-ToastNotify Run-ToastNotify
- Upload ALL the files to the worklet (config-toast.xml, Hidden.vbs, New-ToastNotification.ps1, ToastHeroImageDefault.jpg, ToastLogoImageDefault.jpg):
- Run worklet
After the worklet runs the end user should see this. Take note of the notification icon in lower right with the “moon” logo indicating that Focus Assist is on.

Here you can see where the worklet put data on the local drive

Troubleshooting
log data for the toast notification is stored under C:\Users\%username%\AppData\Roaming\ToastNotficationScript\
