Forum Discussion
A toast notification to display a warning to user if a device not rebooted since x days
Hi,
I found this PowerShell script online to send a warning toast notification to the user if the device has not rebooted for X days.
When running it locally on my device, the script is working with no issue, but there is an error when I deploy it through Intune proactive remediation.
The error is:
Exception calling "Show" with "1" argument(s): "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))" At C:\WINDOWS\IMECache\HealthScripts\610be5e8-e54f-45d6-9738-51bb46c007ee_2\remediate.ps1:145 char:1 + [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotif ... +
Here is the script:
https://github.com/damienvanrobaeys/Intune-Proactive-Remediation-scripts/blob/main/Reboot%20warning/Last_Reboot_Remediation.ps1
The main source:
https://www.systanddeploy.com/2022/02/a-toast-notification-to-display-warning.html?showComment=1659690490713#c8926425382016592058
2 Replies
- Bas1819135Copper Contributor
admin-CPH Hiren Shah
You need to run the script as a user. If you don't, the script will run as SYSTEM, and you will encounter the error 'Access Denied (0x80070005)'. - Hiren ShahCopper Contributor
i have a same problem. let me know if you find the solution. admin-CPH