# Toast Notification: Low Disk Space

## BEFORE YOU BEGIN

{% hint style="info" %}
If you have not read my original blog on [Multi-Language Toast Notifications](https://www.osdsune.com/home/blog/2019/windows10-toast-notification), I recommend that you do so before reading any further.
{% endhint %}

## LOW DISK SPACE

Now that I have successfully used  [Martin Bengtsson](https://twitter.com/mwbengtsson) awesome **Toast Notifications** script for our **Driver Dynamic Driver and BIOS Update** process, I could also see other usage for this script! So here comes one of our latest uses of **Toast Notifications**.

**Martin’s Blog:** <https://bit.ly/35o4sz4>

I will not be deep-diving into the details, so please read my previous blog or Martin’s blog above if you want detailed information about **Toast Notifications**.

Let´s get started - We have for a long time been using collections in **ConfigMgr** that exclude devices with less than 5GB of free disk space from Applications/Program install and Windows Updates, these collections trigger a clean up script to run on these devices.

We want to make our end users aware that when they have less than 5GB of free disk space left on (C:), it has some consequences and that they can do clean up on their device themselves.

I have decided to use **Toasted Notifications** for this awareness purpose which allows users to remind them later or to click on a clean up button which will lead them to the **Storage Sense** in **settings**.

The only difference from my previous **Toast Notification** used for the **Driver Dynamic Driver and BIOS Update** process, is that the text and option for action in the \*.XML has changed to the below value.

```
<Option Name="Action" Value="ms-settings:storagesense" />
```

![Toast Notification - Low Disk Space](https://3347085443-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_qpqqoWaR3gQAWE4Lk%2F-Lw9-t2xv-8o1D0E5ZDI%2F-Lw9-ykJ5fOXcHS3o0Z6%2Fnotify.JPG?alt=media\&token=bf785880-6f0c-4c8d-bf01-e4347590db22)

![Settings - Storage Sense](https://3347085443-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_qpqqoWaR3gQAWE4Lk%2F-Lw8FWfLP98HoHNnd06j%2F-Lw8Fay8SNgvYViXmzcY%2Fstoragesense.JPG?alt=media\&token=d145b959-162b-469b-9aaa-fc98553c43e3)

{% hint style="info" %}
If you can't make it work with "Software Center" as the app for toast notifications, make sure you haven't deleted or hidden the original Software Center shortcut!
{% endhint %}

### ConfigMgr Preparations

We must configure a device collection in **ConfigMgr** that collect devices with less than 5GB of disk space. If not already done, the first thing we need to do here is extend our **Hardware Inventory Class** -> **Logical Disk (SMS\_LogicalDisk)** with **Free Space (MB)** otherwise we will not be able to measure for free disk space on our devices. Just follow these few steps:

**Step 1.** Select **Administration** in the **ConfigMgr** console and go to **Client Settings**

**Step 2.** Open the **Default Client Settings**

![ConfigMgr - Administration](https://3347085443-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_qpqqoWaR3gQAWE4Lk%2F-Lw849q6G9fK95lCVKgX%2F-Lw8EHsH2EPh8iQnBsd5%2Fconfigmgr00.JPG?alt=media\&token=fe6a4600-ebc6-439e-abfc-7565bd0c89db)

**Step 3.** Select **Hardware Inventory** and click **Set Classes**…

![ConfigMgr - Default Client Settings](https://3347085443-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_qpqqoWaR3gQAWE4Lk%2F-Lw849q6G9fK95lCVKgX%2F-Lw8E6cnNuEfSVKs57_c%2Fconfigmgr01.JPG?alt=media\&token=13fae282-773b-4937-9600-b5c6a03a9e7a)

**Step 4.** Scroll down to **Logical Disk (SMS\_LogicalDisk)** and tick the checkbox for **Free Space (MB)**.

![ConfigMgr - Hardware Inventory Classes](https://3347085443-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_qpqqoWaR3gQAWE4Lk%2F-Lw849q6G9fK95lCVKgX%2F-Lw8EoEzqoocjsh3Lo7P%2Fconfigmgr02.JPG?alt=media\&token=91c1d679-3a5e-43b9-a875-89159d0d51e8)

**Step 5.** Now wait for the devices to run **Hardware Inventory Cycle** (Default 7 days)

Once **Hardware Inventory** has finished run its cycle we will be able to see **Free Space (MB)** in the resource explorer for any given device.

![ConfigMgr - Resource Explorer](https://3347085443-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_qpqqoWaR3gQAWE4Lk%2F-Lw8K_pkas1z6QUfWSxX%2F-Lw8LYvYbSggbpEyRhSS%2Fconfigmgr04.JPG?alt=media\&token=fb34829f-ded8-4f4f-b3f8-458fef53b165)

We will now be able to create a device collection that collects devices based on free disk space. Just follow these few steps:

Step 1. Create a new **Device Collection** and add a **query rule**

Step 2. Set the following configuration in the query properties

![ConfigMgr - Collection](https://3347085443-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_qpqqoWaR3gQAWE4Lk%2F-Lw8K_pkas1z6QUfWSxX%2F-Lw8LlQjXy-ume3zaeMv%2Fconfigmgr03.JPG?alt=media\&token=f66ac5a2-7b5f-48eb-aa57-56dfaca3ddc0)

```
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_LOGICAL_DISK on SMS_G_System_LOGICAL_DISK.ResourceID = SMS_R_System.ResourceId where SMS_G_System_LOGICAL_DISK.FreeSpace < 5120 and SMS_G_System_LOGICAL_DISK.DeviceID = "C:"
```

That's all, folks! We are now ready to deploy the **Toast Notification** to our newly created collection to inform our end users to clean up their device. Nice!

For further information on how to deploy a **Toast Notification** with **ConfigMgr**, please take a look at my previous blog post on [Multi-Language Toast Notification](https://www.osdsune.com/home/blog/2019/windows10-toast-notification).

A special thanks go to [Martin](https://twitter.com/mwbengtsson)! If you have any questions regarding this topic, feel free to reach out to me. I am most active on [Twitter](https://twitter.com/SuneThomsenDK)!

Now go out and impress your boss and colleagues!
