Find Windows disks below a free-space threshold
Documentation: Microsoft Learn
Report fixed local disks with less than 20 GiB free, showing free and total capacity as numeric values.
Example reviewed 1 October 2026 · Illustrative output · Not a live system check
The script
$MinimumFreeBytes = 20GB
Get-CimInstance Win32_LogicalDisk -Filter 'DriveType=3' -ErrorAction Stop |
Where-Object FreeSpace -lt $MinimumFreeBytes |
Select-Object DeviceID,
@{Name='FreeGB'; Expression={[math]::Round($_.FreeSpace / 1GB, 1)}},
@{Name='SizeGB'; Expression={[math]::Round($_.Size / 1GB, 1)}}Script reader
Inspect before you run
Inspect the script below. It does not run in this browser.
Inspection only — no command has run.
Show reference output
Fictional reference snapshot · 03 October 2026, 09:00 UTC. This is an example result, not a check of your systems.
DeviceID FreeGB SizeGB -------- ------ ------ C: 12.4 128
Inspect this example’s structure
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
$MinimumFreeBytes = 20GB
Get-CimInstance Win32_LogicalDisk -Filter 'DriveType=3' -ErrorAction Stop |
Where-Object FreeSpace -lt $MinimumFreeBytes |
Select-Object DeviceID,
@{Name='FreeGB'; Expression={[math]::Round($_.FreeSpace / 1GB, 1)}},
@{Name='SizeGB'; Expression={[math]::Round($_.Size / 1GB, 1)}}- Stage 1$MinimumFreeBytes
Positional values or no named parameters - Stage 2Where-Object
-lt - Stage 3Select-Object
Positional values or no named parameters
Illustrative output
This example shows the expected shape for fictional data. Your values and formatting will differ.
DeviceID FreeGB SizeGB C: 12.4 476.1
How it works
The CIM filter selects fixed disks. Where-Object applies the 20GB threshold in bytes before rounding for display. The FreeGB and SizeGB labels use the common PowerShell convention; their divisors are binary gigabytes (GiB).
Before you run it
Windows and permission to query Win32_LogicalDisk are required. Choose a threshold suitable for the workload; a single absolute limit does not replace percentage-free or growth-rate checks.
Check the result
Confirm the selected drive and compare raw FreeSpace with the threshold. Inspect trends and application requirements before planning cleanup. This report does not delete files.
If nothing is returned
If the query succeeded, no returned fixed local disk had less than 20 GiB free. Network shares and other excluded storage still need their own checks.