1
0
mirror of https://github.com/fleschutz/PowerShell.git synced 2025-01-16 19:09:04 +01:00

Update check-swap-space.ps1

This commit is contained in:
Markus Fleschutz 2024-06-15 11:55:22 +02:00
parent 8bf0a8e8f0
commit 119d37e4f3

View File

@ -7,7 +7,7 @@
Specifies the minimum level in GB (10 GB by default) Specifies the minimum level in GB (10 GB by default)
.EXAMPLE .EXAMPLE
PS> ./check-swap-space.ps1 PS> ./check-swap-space.ps1
Swap space uses 51% of 2GB - 948MB free Swap space uses 21% of 1GB - 1005MB free
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -17,15 +17,15 @@
param([int]$minLevel = 10) param([int]$minLevel = 10)
function MB2String { param([int64]$bytes) function MB2String { param([int64]$bytes)
if ($bytes -lt 1000) { return "$($bytes)MB" } if ($bytes -lt 1024) { return "$($bytes)MB" }
$bytes /= 1000 $bytes /= 1024
if ($bytes -lt 1000) { return "$($bytes)GB" } if ($bytes -lt 1024) { return "$($bytes)GB" }
$bytes /= 1000 $bytes /= 1024
if ($bytes -lt 1000) { return "$($bytes)TB" } if ($bytes -lt 1024) { return "$($bytes)TB" }
$bytes /= 1000 $bytes /= 1024
if ($bytes -lt 1000) { return "$($bytes)PB" } if ($bytes -lt 1024) { return "$($bytes)PB" }
$bytes /= 1000 $bytes /= 1024
if ($bytes -lt 1000) { return "$($bytes)EB" } if ($bytes -lt 1024) { return "$($bytes)EB" }
} }
try { try {