Update check-swap-space.ps1 and ping-local-hosts.ps1

This commit is contained in:
Markus Fleschutz 2024-01-19 16:02:42 +01:00
parent fa91cb5236
commit b56bcbcecd
2 changed files with 5 additions and 5 deletions

View File

@ -49,8 +49,8 @@ try {
Write-Output "⚠️ Swap space of $(MB2String $Total) is full" Write-Output "⚠️ Swap space of $(MB2String $Total) is full"
} elseif ($Free -lt $minLevel) { } elseif ($Free -lt $minLevel) {
Write-Output "⚠️ Swap space of $(MB2String $Total) is nearly full, only $(MB2String $Free) free" Write-Output "⚠️ Swap space of $(MB2String $Total) is nearly full, only $(MB2String $Free) free"
} elseif ($Used -eq 0) { } elseif ($Used -lt 5) {
Write-Output "✅ Swap space of $(MB2String $Total) reserved" Write-Output "✅ Swap space unused, $(MB2String $Free) free"
} else { } else {
[int]$Percent = ($Used * 100) / $Total [int]$Percent = ($Used * 100) / $Total
Write-Output "✅ Swap space uses $Percent%, $(MB2String $Free) free of $(MB2String $Total)" Write-Output "✅ Swap space uses $Percent%, $(MB2String $Free) free of $(MB2String $Total)"

View File

@ -5,7 +5,7 @@
This PowerShell script pings the computers in the local network and lists which one are up. This PowerShell script pings the computers in the local network and lists which one are up.
.EXAMPLE .EXAMPLE
PS> ./ping-local-hosts.ps1 PS> ./ping-local-hosts.ps1
Hippo Jenkins01 Jenkins02 Rocket Vega are up. Up: Hippo Jenkins01 Jenkins02 Rocket Vega
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -42,9 +42,9 @@ try {
$queue.Enqueue($obj) $queue.Enqueue($obj)
} }
Write-Progress -completed "Done." Write-Progress -completed "Done."
Write-Host "$($result)are up." Write-Host "Up: $($result)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }