System Center

SCCM – Low Disk Space SQL Query

Last updated on March 30th, 2023 at 06:06 pm

Read Time:1 Minute, 6 Second

This is a SQL query for your SCCM database or you can use it to create a report using SSRS.

For this work, you must ensure that you have the Logical Disk class enabled in the hardware inventory settings.

This will give you the following information:

  • Computer Name
  • Disk Description
  • Drive Letter
  • Volume Name
  • File System
  • Total Size
  • Free Space

This is based on disk space that is less than 10% of the total size of the disk or if less than 1GB within the All Devices collection.

SELECT distinct
SYS.Name,
LDSK.Description0 AS [Description],
LDSK.DeviceID0 AS [Drive],
LDSK.VolumeName0 AS [Volume Name],
LDSK.FileSystem0 AS [Filesystem],
LDSK.Size0 AS [Total Size],
LDSK.FreeSpace0 AS [Free Space]
FROM
v_FullCollectionMembership_Valid SYS
JOIN v_GS_LOGICAL_DISK LDSK
on SYS.ResourceID = LDSK.ResourceID
WHERE LDSK.DriveType0 = 3
AND ((LDSK.FreeSpace0 <= ((LDSK.Size0 * 10)/100))
or (LDSK.FreeSpace0 <= 1024))
and sys.CollectionID = ‘SMS00001’

More Queries

Our full range of SQL and WQL Collection queries are available here.

Feedback

If you have any questions or feedback about this post, or if you would like us to create any queries for you, please go ahead and leave us a message below in the comments section and we will get back to you as quick as we can.

Avatar for Andrew Armstrong

About Post Author

Andrew Armstrong

Founder of TechyGeeksHome and Head Editor for over 15 years! IT expert in multiple areas for over 23 years. Sharing experience and knowledge whenever possible! Making IT Happen.
administrator
Click to rate this post!
[Total: 0 Average: 0]

Free Subscription

If you want to be notified when we post more quality guides like this one, sign up to our free subscription service and you will receive an email when a new post is live.

Join 4,418 other subscribers.

No need to worry, we will not be filling your inbox with spam and you can unsubscribe anytime you like.