Skip to content

Commit 4c3afd9

Browse files
committed
Update check-drives.ps1
1 parent 75d513a commit 4c3afd9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Scripts/check-drives.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
.PARAMETER MinLevel
77
Specifies the minimum warning level (10 GB by default)
88
.EXAMPLE
9-
PS> ./check-drives
10-
✅ Drive C: with 250GB is 10% full, 225GB free
9+
PS> ./check-drives.ps1
10+
✅ Drive C: with 250GB at 10%, 225GB free
1111
.LINK
1212
https://github.com/fleschutz/PowerShell
1313
.NOTES
@@ -51,7 +51,11 @@ try {
5151
Write-Host "⚠️ Drive $ID with $(Bytes2String $Total) is nearly full, $(Bytes2String $Free) free"
5252
} else {
5353
[int]$Percent = ($Used * 100) / $Total
54-
Write-Host "✅ Drive $ID with $(Bytes2String $Total) is $Percent% full, $(Bytes2String $Free) free"
54+
if ($Percent -gt 90) {
55+
Write-Host "✅ Drive $ID with $(Bytes2String $Total) is $Percent% full, $(Bytes2String $Free) free"
56+
} else {
57+
Write-Host "✅ Drive $ID with $(Bytes2String $Total) at $Percent%, $(Bytes2String $Free) free"
58+
}
5559
}
5660
}
5761
exit 0 # success

0 commit comments

Comments
 (0)