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

This commit is contained in:
Markus Fleschutz 2023-10-09 16:12:17 +02:00
parent a679bdfc48
commit 7baef5ef74
2 changed files with 5 additions and 5 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: uses 49% of 1TB, 512GB free Drive C: at 49%, 512GB free of 1TB
Drive D: uses 84% of 4TB, 641GB free Drive D: at 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 uses $percent% of $(Bytes2String $total), $(Bytes2String $free) free" Write-Host "✅ Drive $name at $percent%, $(Bytes2String $free) free of $(Bytes2String $total)"
} }
} }
exit 0 # success exit 0 # success

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 42% of 1GB, 748MB free Swap space at 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 uses $Percent% of $(MB2String $Total), $(MB2String $Free) free" Write-Output "✅ Swap space at $Percent%, $(MB2String $Free) free of $(MB2String $Total)"
} }
exit 0 # success exit 0 # success
} catch { } catch {