Update check-drives.ps1

This commit is contained in:
Markus Fleschutz 2021-12-06 19:21:15 +01:00
parent 8301a63a6a
commit 7aa7af1028

View File

@ -24,10 +24,12 @@ try {
[int]$Used = (($DriveDetails.Used / 1024) / 1024) / 1024
[int]$Total = ($Used + $Free)
if ($Free -lt $MinLevel) {
$Reply = "Drive $($Drive.Name) has only $Free GB left to use! ($Used of $Total GB used, minimum is $MinLevel GB)"
if ($Total -eq "0") {
$Reply = "Drive $($Drive.Name) is empty."
} elseif ($Free -lt $MinLevel) {
$Reply = "Drive $($Drive.Name) has only $Free GB left to use! $Used of $Total GB is in use."
} else {
$Reply = "Drive $($Drive.Name) has $($Free)GB left ($($Total)GB total)"
$Reply = "Drive $($Drive.Name) has $($Free) GB left, $($Total) GB total."
}
& "$PSScriptRoot/give-reply.ps1" "$Reply"
}