Improved output of some scripts

This commit is contained in:
Markus Fleschutz 2024-06-07 14:41:26 +02:00
parent 65275c7ca5
commit 3994d23478
3 changed files with 7 additions and 7 deletions

View File

@ -9,7 +9,7 @@
Specifies the minimum level in bytes (10GB by default)
.EXAMPLE
PS> ./check-drive-space.ps1 C
Drive C: has 442GB free (56% of 1TB used)
Drive C: uses 56% of 1TB - 442GB free
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -49,7 +49,7 @@ try {
Write-Host "⚠️ Drive $driveName with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
} else {
[int64]$percent = ($used * 100) / $total
Write-Host "✅ Drive $driveName has $(Bytes2String $free) free ($percent% of $(Bytes2String $total) used)"
Write-Host "✅ Drive $driveName uses $percent% of $(Bytes2String $total) - $(Bytes2String $free) free"
}
exit 0 # success
} catch {

View File

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

View File

@ -7,7 +7,7 @@
Specifies the minimum level in GB (10 GB by default)
.EXAMPLE
PS> ./check-swap-space.ps1
Swap space has 748MB free (42% of 1GB used)
Swap space uses 51% of 2GB - 948MB free
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -55,7 +55,7 @@ try {
Write-Output "✅ Swap space has all $(MB2String $free) free"
} else {
[int64]$percent = ($used * 100) / $total
Write-Output "✅ Swap space has $(MB2String $free) free ($percent% of $(MB2String $total) used)"
Write-Output "✅ Swap space uses $percent% of $(MB2String $total) - $(MB2String $free) free"
}
exit 0 # success
} catch {