WQL collection queries

Find computers with less than 10 GB free disk space

A WQL collection query that returns computers whose C: drive has less free space than the number of megabytes you set.

LanguageWQL
What it does to the systemReads only. It changes nothing.

This query builds a device collection of computers that are low on disk space. It checks the free space on the C: drive.

Use it before a feature update or a large application install. You can also deploy a cleanup script to it.

WQL
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.DeviceID = "C:"
  and SMS_G_System_LOGICAL_DISK.DriveType = 3
  and SMS_G_System_LOGICAL_DISK.FreeSpace < 10240

How to use it

  1. In the console, open Assets and Compliance, then Device Collections.
  2. Open the collection properties. On Membership Rules, select Add Rule, then Query Rule.
  3. Select Edit Query Statement, then Show Query Language. Paste the query.
  4. Change 10240 to your limit in megabytes. Multiply gigabytes by 1024, so 20 GB is 20480.
  5. Change "C:" to check a different drive letter.

Good to know

  • SCCM stores FreeSpace in megabytes. Drive type 3 means a local fixed disk.
  • The value is as old as the last hardware inventory. A computer can fill up or free space between cycles.
disk space free space SMS_G_System_LOGICAL_DISK C drive
✉

Get new articles in your inbox

SCCM guides, AI tools, automation tips — sent when published. No spam.