Updated check-drives.ps1

This commit is contained in:
Markus Fleschutz 2024-08-17 14:01:52 +02:00
parent ea6e22b3d2
commit bc52eaf3f6

View File

@ -7,8 +7,8 @@
Specifies the minimum warning level (10GB by default) Specifies the minimum warning level (10GB by default)
.EXAMPLE .EXAMPLE
PS> ./check-drives.ps1 PS> ./check-drives.ps1
Drive C: uses 49% of 1TB - 512GB free Drive C: at 49% of 1TB - 512GB free
Drive D: uses 84% of 4TB - 641GB free Drive D: at 84% of 4TB - 641GB free
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -46,7 +46,7 @@ try {
Write-Host "⚠️ Drive $name with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free" Write-Host "⚠️ Drive $name with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
} else { } else {
[int64]$percent = ($used * 100) / $total [int64]$percent = ($used * 100) / $total
Write-Host "✅ Drive $name uses $percent% of $(Bytes2String $total) - $(Bytes2String $free) free" Write-Host "✅ Drive $name at $percent% of $(Bytes2String $total) - $(Bytes2String $free) free"
} }
} }
exit 0 # success exit 0 # success