1
0
mirror of https://github.com/fleschutz/PowerShell.git synced 2025-07-03 14:10:07 +02:00

Update check-drives.ps1 and check-swap-space.ps1

This commit is contained in:
Markus Fleschutz
2023-10-13 08:06:24 +02:00
parent fc2f04a133
commit a3300d75e2
2 changed files with 7 additions and 7 deletions

@ -7,8 +7,8 @@
Specifies the minimum warning level (10 GB by default)
.EXAMPLE
PS> ./check-drives.ps1
✅ Drive C: at 49%, 512GB free of 1TB
✅ Drive D: at 84%, 641GB free of 4TB
✅ Drive C: uses 49%, 512GB free of 1TB
✅ Drive D: uses 84%, 641GB free of 4TB
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -51,7 +51,7 @@ try {
Write-Host "⚠️ Drive $name with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
} else {
[int]$percent = ($used * 100) / $total
Write-Host "✅ Drive $name at $percent%, $(Bytes2String $free) free of $(Bytes2String $total)"
Write-Host "✅ Drive $name uses $percent%, $(Bytes2String $free) free of $(Bytes2String $total)"
}
}
exit 0 # success

@ -1,13 +1,13 @@
<#
.SYNOPSIS
Checks the swap space status
Checks the swap space
.DESCRIPTION
This PowerShell script queries the status of the swap space and prints it.
This PowerShell script queries the current status of the swap space and prints it.
.PARAMETER minLevel
Specifies the minimum level in GB (10 GB by default)
.EXAMPLE
PS> ./check-swap-space.ps1
✅ Swap space at 42%, 748MB free of 1GB
✅ Swap space uses 42%, 748MB free of 1GB
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -53,7 +53,7 @@ try {
Write-Output "✅ Swap space of $(MB2String $Total) reserved"
} else {
[int]$Percent = ($Used * 100) / $Total
Write-Output "✅ Swap space at $Percent%, $(MB2String $Free) free of $(MB2String $Total)"
Write-Output "✅ Swap space uses $Percent%, $(MB2String $Free) free of $(MB2String $Total)"
}
exit 0 # success
} catch {