Improve the scripts

This commit is contained in:
Markus Fleschutz
2021-04-17 18:54:45 +02:00
parent 9aa997ebf5
commit f78a9390cb
9 changed files with 15 additions and 20 deletions

View File

@ -8,9 +8,7 @@
param($Drive = "", [int]$MinLevel = 50) # minimum level in GB
if ($Drive -eq "" ) {
$Drive = read-host "Enter drive to check"
}
if ($Drive -eq "" ) { $Drive = read-host "Enter drive to check" }
try {
$DriveDetails = (get-psdrive $Drive)
@ -22,7 +20,7 @@ try {
write-warning "Drive $Drive has only $Free GB left to use! ($Used GB out of $Total GB in use, minimum is $MinLevel GB)"
exit 1
}
write-host -foregroundColor green "✔️ $Free GB left on drive $Drive ($Used GB of $Total GB used)"
"✔️ $Free GB left on drive $Drive ($Used GB of $Total GB used)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"