Script to disable toast notification on Windows devices
Toast notifications, often called pop-up notifications, are short alert messages that show up in the lower-right corner of your computer screen. They will give you timely updates and information on your apps, system events, and other activities on your computer. Disabling toast notifications will prevent users from being interrupted by irrelevant notifications, reduce distraction, improve focus, and even improve the battery life of the device.
While you can disable toast notifications in Windows Settings, users can enable the option if they want to. By using the script below, IT Administrators can disable toast notifications, preventing users from making modifications. This can be achieved through Hexnode’s “Execute Custom Script” action.
Batch script to disable toast/pop-up notifications on Windows devices
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications /v ToastEnabled /t REG_DWORD /d 0 /f
The “reg add” command is used to add or modify a registry entry. “/f” is a parameter that forces the creation of the registry entry without asking for confirmation.
PowerShell script to disable toast/pop-up notifications on Windows devices
New-Item -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Force -ErrorAction SilentlyContinue | Set-ItemProperty -Name ToastEnabled -Value 0
“-Force” in PowerShell commands allows overwriting or creating registry keys without confirmation.The “–ErrorAction” parameter is used to specify how PowerShell should handle errors. By providing “SilentlyContinue” as the value for “-ErrorAction”, PowerShell suppresses error messages, allowing the script to proceed to the next command without displaying any error messages.
The scripts will change the registry value of ‘ToastEnabled’ from 1 to 0, thus disabling toast notification from being displayed on devices.
What happens at the device end?
With the execution of this script, the Notifications settings under Windows settings > System will be greyed out and the user will not be able to modify it.