Notify users when their device is running low on disk space using Toast Notifications and Endpoint Analytics Proactive Remediations

Introduction

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

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.

Endpoint Analytics

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:

Script Package

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:

Detection Script

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.

.

Remediation script

  • 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

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.

In Action

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

ENJOY 🙂

4 thoughts on “Notify users when their device is running low on disk space using Toast Notifications and Endpoint Analytics Proactive Remediations”

  1. Hi,
    This is really useful, thanks!
    I’ve managed to get it working as a Proactive Remediation and uploaded the XML file to our blob storage, however, it doesn’t pick up the logo image. I’ve uploaded the logo to the same blob storage and tried putting the URL in the $LogoImageTemp & $LogoImage variables but it doesn’t pick this up..
    Can you please advise where I can input the logo URL?
    Thank you,
    Kyle

    Reply
    • Please see my recent comment. You are welcome to test with my images hosted online in my blob storage. It works in my end.

      Reply
  2. How would I use the logo if it is being hosted in blob storage? (same as the XML file).
    I’ve tried setting the “LogoImageName” in the XML to the shared access URL I created but this doesn’t work and I’ve also tried setting the $LogoImageTemp and $LogoImage variables to the URL but this also fails.
    Thank you,
    Kyle

    Reply
    • I have successfully used online images stored in blob storage like this (os those are publicly available, so you would be able to test with those):

      Option Name=”LogoImageName” Value=”https://krpublicfiles.blob.core.windows.net/toastnotification/ToastLogoImageDefault.jpg”

      Option Name=”HeroImageName” Value=”https://krpublicfiles.blob.core.windows.net/toastnotification/ToastHeroImageDefault.jpg”

      Reply

Leave a Reply to Kyle Blackman Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.