Update check-drives.ps1

This commit is contained in:
Markus Fleschutz 2022-10-25 15:15:43 +02:00
parent e192342523
commit 1a83a3032d

View File

@ -1,8 +1,8 @@
<# <#
.SYNOPSIS .SYNOPSIS
Checks the free space of all drives Checks the drive space
.DESCRIPTION .DESCRIPTION
This PowerShell script checks all drives for free space left (10 GB by default). This PowerShell script checks all drives for free space left.
.PARAMETER MinLevel .PARAMETER MinLevel
Specifies the minimum warning level (10 GB by default) Specifies the minimum warning level (10 GB by default)
.EXAMPLE .EXAMPLE
@ -24,10 +24,12 @@ try {
[int]$Used = $Details.Used / 1GB [int]$Used = $Details.Used / 1GB
[int]$Total = ($Used + $Free) [int]$Total = ($Used + $Free)
if ($Total -eq "0") { if ($Total -eq 0) {
"✅ Drive $ID is empty." "✅ Drive $ID is empty."
} elseif ($Free -lt $MinLevel) { } elseif ($Free -lt $MinLevel) {
"⚠️ Drive $ID has only $Free GB of $Total GB left to use!" "⚠️ Drive $ID has only $Free GB of $Total GB left to use!"
} elseif ($Used -lt $Free) {
"✅ Drive $ID uses $Used GB of $Total GB."
} else { } else {
"✅ Drive $ID has $Free GB of $Total GB left." "✅ Drive $ID has $Free GB of $Total GB left."
} }