Skip to content

Commit 08c8d62

Browse files
committed
Update check-swap-space.ps1
1 parent 920c0d4 commit 08c8d62

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Scripts/check-swap-space.ps1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Specifies the minimum level (10 GB by default)
88
.EXAMPLE
99
PS> ./check-swap-space.ps1
10-
✅ Swap space uses 122MB (10%) of 1GB
10+
✅ Swap space 10% full, 901MB of 1TB free
1111
.LINK
1212
https://github.com/fleschutz/PowerShell
1313
.NOTES
@@ -51,11 +51,9 @@ try {
5151
Write-Output "⚠️ Swap space of $(MB2String $Total) is nearly full ($(MB2String $Free) free)"
5252
} elseif ($Used -eq 0) {
5353
Write-Output "✅ Swap space with $(MB2String $Total) reserved"
54-
} elseif ($Used -lt $Free) {
55-
[int]$Percent = ($Used * 100) / $Total
56-
Write-Output "✅ Swap space uses $(MB2String $Used) ($($Percent)%) of $(MB2String $Total)"
5754
} else {
58-
Write-Output "✅ Swap space has $(MB2String $Free) of $(MB2String $Total) free"
55+
[int]$Percent = ($Used * 100) / $Total
56+
Write-Output "✅ Swap space $Percent% full, $(MB2String $Free) of $(MB2String $Total) free"
5957
}
6058
exit 0 # success
6159
} catch {

0 commit comments

Comments
 (0)