mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-24 10:58:16 +02:00
Update check-drives.ps1
This commit is contained in:
parent
75d513a1e5
commit
4c3afd9119
@ -6,8 +6,8 @@
|
|||||||
.PARAMETER MinLevel
|
.PARAMETER MinLevel
|
||||||
Specifies the minimum warning level (10 GB by default)
|
Specifies the minimum warning level (10 GB by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-drives
|
PS> ./check-drives.ps1
|
||||||
✅ Drive C: with 250GB is 10% full, 225GB free
|
✅ Drive C: with 250GB at 10%, 225GB free
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -51,7 +51,11 @@ try {
|
|||||||
Write-Host "⚠️ Drive $ID with $(Bytes2String $Total) is nearly full, $(Bytes2String $Free) free"
|
Write-Host "⚠️ Drive $ID with $(Bytes2String $Total) is nearly full, $(Bytes2String $Free) free"
|
||||||
} else {
|
} else {
|
||||||
[int]$Percent = ($Used * 100) / $Total
|
[int]$Percent = ($Used * 100) / $Total
|
||||||
|
if ($Percent -gt 90) {
|
||||||
Write-Host "✅ Drive $ID with $(Bytes2String $Total) is $Percent% full, $(Bytes2String $Free) free"
|
Write-Host "✅ Drive $ID with $(Bytes2String $Total) is $Percent% full, $(Bytes2String $Free) free"
|
||||||
|
} else {
|
||||||
|
Write-Host "✅ Drive $ID with $(Bytes2String $Total) at $Percent%, $(Bytes2String $Free) free"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
Loading…
Reference in New Issue
Block a user