File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 5
5
This PowerShell script queries the status of the system battery and prints it.
6
6
. EXAMPLE
7
7
PS> ./check-battery
8
- ✅ Battery at 21% , 54 min remaining
8
+ ✅ Battery 9% low , 54 min remaining
9
9
. LINK
10
10
https://github.com/fleschutz/PowerShell
11
11
. NOTES
@@ -29,12 +29,16 @@ try {
29
29
$Reply = " ✅ Battery charging... ($Percent %)"
30
30
}
31
31
} 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 ) {
33
37
$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"
36
40
} else {
37
- $Reply = " ⚠️ Battery at $Percent %, only $Remaining min remaining"
41
+ $Reply = " ✅ Battery at $Percent %, $Remaining min remaining"
38
42
}
39
43
}
40
44
}
You can’t perform that action at this time.
0 commit comments