mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-29 10:09:37 +01:00
Update check-drives.ps1 and check-swap-space.ps1
This commit is contained in:
parent
fc2f04a133
commit
a3300d75e2
@ -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
|
||||||
|
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user