Skip to content

Commit 4c3327b

Browse files
committed
Update check-battery.ps1
1 parent 128f460 commit 4c3327b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Scripts/check-battery.ps1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
This PowerShell script queries the status of the system battery and prints it.
66
.EXAMPLE
77
PS> ./check-battery
8-
✅ Battery at 21%, 54 min remaining
8+
✅ Battery 9% low, 54 min remaining
99
.LINK
1010
https://github.com/fleschutz/PowerShell
1111
.NOTES
@@ -29,12 +29,16 @@ try {
2929
$Reply = "✅ Battery charging... ($Percent%)"
3030
}
3131
} else { # must be offline
32-
if ($Percent -ge 80) {
32+
if ($Remaining -le 5) {
33+
$Reply = "⚠️ Battery at $Percent%, ONLY $Remaining MIN remaining"
34+
} elseif ($Remaining -le 30) {
35+
$Reply = "⚠️ Battery at $Percent%, only $Remaining min remaining"
36+
} elseif ($Percent -ge 80) {
3337
$Reply = "✅ Battery $Percent% full, $Remaining min remaining"
34-
} elseif ($Remaining -gt 30) {
35-
$Reply = "✅ Battery at $Percent%, $Remaining min remaining"
38+
} elseif ($Percent -le 10) {
39+
$Reply = "✅ Battery $Percent% low, $Remaining min remaining"
3640
} else {
37-
$Reply = "⚠️ Battery at $Percent%, only $Remaining min remaining"
41+
$Reply = " Battery at $Percent%, $Remaining min remaining"
3842
}
3943
}
4044
}

0 commit comments

Comments
 (0)