This is a follow up, on the post I did a few weeks ago, on notifying users with devices being low on disk space, using Toast Notifications and Configuration Manager
- Find the mentioned post here: Notify users when their device is running low on disk space using Toast Notifications and Configuration Manager
This time, I’m moving all of it, into the Endpoint Analytics Proactive Remediations feature of Microsoft Endpoint Manager Intune. This will actually simplify things a lot, as it removes the need for custom collections, Configuration Items and Baselines.
For those who’s unfamiliar with the Proactive Remediations feature, this is located in the Microsoft Endpoint Manager admin center, and is found via Reports -> Endpoint Analytics -> Proactive remediations:
As usual, I’m jumping straight into our own production environment, and in order for you to get started with this particular topic, you will need to create a new script package as highlighted below:
The detection script, is the one doing the magic in locating devices being low on disk space.
The script is available from my GitHub page: Powershell/Detect-LowDiskSpace.ps1 at master · imabdk/Powershell (github.com)
The detection script is going into the Detection script area where it’s mandatory.
BIG NOTE: I have intentionally configured the detection script, to detect if the free disk space is less than or equal to 70%. That’s probably not how you want it configured in real life. This was done in order for me to test this on my own device.
- NOTE: It’s not a requirement to be using a Remediation script. If you don’t intend to display the users a toast notification, simply leaving the remediation script blank will work. In this case, you can use the feature for the audit and monitoring possibilities.
The remediation script is my entire Windows 10 Toast Notification Script found here: https://www.imab.dk/windows-10-toast-notification-script/
Proactive Remediations doesn’t support passing parameters to the script, so in order for the Toast Notification Script to work, you will have to hard code the path to the config.xml file like shown below:
NOTE: Again, the Toast Notification Script has been modified to now support config.xml files being hosted online. Here, I’m hosting a config.xml in blob storage in Azure. You will need to host your config.xml in a similar fashion.
[string]$Config = “https://krpublicfiles.blob.core.windows.net/toastnotification/config-toast-lowdiskspace.xml”
Assignments is the last part of setting this up, as well as deciding how often the script will run.
For testing purposes, I’m running this every hour.
When everything is properly setup, you will see that the detection script finds devices which is running low on disk space.
On those devices, a Toast Notification is displayed, similar to those toast examples in the beginning of this post.
Taking a closer look on IntuneManagementExtension.log (C:\ProgramData\Microsoft\IntuneManagementExtension\Logs) you will also notice the reason for the Toast Notification to be displayed:
As well as when the Remeditation script is run, the Toast Notification Script writes an output when successfully displayed:
[HS] lastLine of output = All good. Toast notification was displayed