PowerShell · Endpoints
Find endpoints with low disk space
Run via your RMM on each managed endpoint or schedule it as a daily task. Reports every logical disk where free space is below the threshold so you can proactively clean up or expand storage before users are impacted. Adjust the threshold percentage to match your SLA.
Script
Code
$ThresholdPct = 10
Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DriveType = 3" |
ForEach-Object {
$freePct = if ($_.Size -gt 0) {
[math]::Round(($_.FreeSpace / $_.Size) * 100, 1)
} else { 0 }
[pscustomobject]@{
Drive = $_.DeviceID
SizeGB = [math]::Round($_.Size / 1GB, 1)
FreeGB = [math]::Round($_.FreeSpace / 1GB, 1)
FreePct = $freePct
LowSpace = $freePct -lt $ThresholdPct
}
} |
Where-Object { $_.LowSpace } |
Format-Table -AutoSizeUsage
How to use this script
Run via your RMM on each managed endpoint or schedule it as a daily task. Reports every logical disk where free space is below the threshold so you can proactively clean up or expand storage before users are impacted. Adjust the threshold percentage to match your SLA.
Review the script and test in a non-production environment before running at scale.
Tags
endpointsdisk-spacemonitoringreporting
More scripts