mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-24 19:08:27 +02:00
Updated check-drives.ps1
This commit is contained in:
parent
f0272d1d37
commit
8aa468feb7
@ -7,8 +7,7 @@
|
|||||||
Specifies the minimum warning level (10GB by default)
|
Specifies the minimum warning level (10GB by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-drives.ps1
|
PS> ./check-drives.ps1
|
||||||
✅ C: at 49% of 1TB - 512GB free
|
✅ 📂C: has 432GB of 930GB left (54% full) 📂D: has 507GB of 4TB left (86% full) 📂E: is empty
|
||||||
✅ D: at 84% of 4TB - 641GB free
|
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -42,13 +41,13 @@ try {
|
|||||||
$reply += "📂$name is empty "
|
$reply += "📂$name is empty "
|
||||||
} elseif ($free -eq 0) {
|
} elseif ($free -eq 0) {
|
||||||
$status = "⚠️"
|
$status = "⚠️"
|
||||||
$reply += "📂$name is full ($(Bytes2String $total)) "
|
$reply += "📂$name with ($(Bytes2String $total)) is FULL "
|
||||||
} elseif ($free -lt $minLevel) {
|
} elseif ($free -lt $minLevel) {
|
||||||
$status = "⚠️"
|
$status = "⚠️"
|
||||||
$reply += "📂$name is nearly full ($(Bytes2String $free) of $(Bytes2String $total) left) "
|
$reply += "📂$name is nearly full ($(Bytes2String $free) of $(Bytes2String $total) left) "
|
||||||
} else {
|
} else {
|
||||||
[int64]$percent = ($free * 100) / $total
|
[int64]$percent = ($used * 100) / $total
|
||||||
$reply += "📂$name has $(Bytes2String $free) of $(Bytes2String $total) left ($percent%) "
|
$reply += "📂$name has $(Bytes2String $free) of $(Bytes2String $total) left ($percent% full) "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Write-Host "$status $reply"
|
Write-Host "$status $reply"
|
||||||
|
Loading…
Reference in New Issue
Block a user