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

View File

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

View File

@ -1,13 +1,13 @@
<# <#
.SYNOPSIS .SYNOPSIS
Checks the swap space status Checks the swap space
.DESCRIPTION .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 .PARAMETER minLevel
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 at 42%, 748MB free of 1GB Swap space uses 42%, 748MB free of 1GB
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -53,7 +53,7 @@ try {
Write-Output "✅ Swap space of $(MB2String $Total) reserved" Write-Output "✅ Swap space of $(MB2String $Total) reserved"
} else { } else {
[int]$Percent = ($Used * 100) / $Total [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 exit 0 # success
} catch { } catch {