Update some check-*.ps1 scripts

This commit is contained in:
Markus Fleschutz
2022-10-09 12:34:06 +02:00
parent b6baa94e3b
commit 888e0a5408
9 changed files with 50 additions and 60 deletions

View File

@ -11,6 +11,8 @@
Author: Markus Fleschutz | License: CC0
#>
param([int]$MinLevel = 50) # 50 GB minimum
try {
$Drives = Get-PSDrive -PSProvider FileSystem
foreach($Drive in $Drives) {
@ -20,13 +22,13 @@ try {
[int]$Total = ($Used + $Free)
if ($Total -eq "0") {
$Reply = "Drive $($Drive.Name) is empty."
$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."
$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."
}
"* $Reply"
"$Reply"
}
exit 0 # success
} catch {