Improved some scripts

This commit is contained in:
Markus Fleschutz 2024-03-16 11:36:02 +01:00
parent a316ad6e27
commit 513c60d5f9
3 changed files with 4 additions and 4 deletions

View File

@ -48,7 +48,7 @@ try {
} elseif ($free -lt $minLevel) {
Write-Host "⚠️ Drive $driveName with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
} else {
[int]$percent = ($used * 100) / $total
[int64]$percent = ($used * 100) / $total
Write-Host "✅ Drive $driveName has $(Bytes2String $free) free ($percent% of $(Bytes2String $total) used)"
}
exit 0 # success

View File

@ -45,7 +45,7 @@ try {
} elseif ($free -lt $minLevel) {
Write-Host "⚠️ Drive $name with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
} else {
[int]$percent = ($used * 100) / $total
[int64]$percent = ($used * 100) / $total
Write-Host "✅ Drive $name has $(Bytes2String $free) free ($percent% of $(Bytes2String $total) used)"
}
}

View File

@ -54,8 +54,8 @@ try {
} elseif ($used -lt 5) {
Write-Output "✅ Swap space has the full $(MB2String $free) free"
} else {
[int]$Percent = ($used * 100) / $total
Write-Output "✅ Swap space has $(MB2String $free) free ($Percent% of $(MB2String $total) used)"
[int64]$percent = ($used * 100) / $total
Write-Output "✅ Swap space has $(MB2String $free) free ($percent% of $(MB2String $total) used)"
}
exit 0 # success
} catch {