Updated the manuals

This commit is contained in:
Markus Fleschutz
2024-11-08 12:35:11 +01:00
parent 53eb60baa3
commit 54635c32da
636 changed files with 5289 additions and 2027 deletions

View File

@@ -6,7 +6,7 @@ This PowerShell script queries the power status and prints it.
Parameters
----------
```powershell
PS> ./check-power.ps1 [<CommonParameters>]
/home/markus/Repos/PowerShell/scripts/check-power.ps1 [<CommonParameters>]
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
@@ -17,7 +17,7 @@ Example
-------
```powershell
PS> ./check-power.ps1
Battery at 9% with 54min remaining · power scheme 'HP Optimized'
Battery 9% only with 54min remaining (power scheme is 'HP Optimized')
```
@@ -39,7 +39,7 @@ Script Content
This PowerShell script queries the power status and prints it.
.EXAMPLE
PS> ./check-power.ps1
⚠️ Battery at 9% with 54min remaining · power scheme 'HP Optimized'
⚠️ Battery 9% only with 54min remaining (power scheme is 'HP Optimized')
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@@ -54,35 +54,34 @@ try {
$details = [System.Windows.Forms.SystemInformation]::PowerStatus
[int]$percent = 100 * $details.BatteryLifePercent
[int]$remaining = $details.BatteryLifeRemaining / 60
$powerScheme = (powercfg /getactivescheme)
$powerScheme = $powerScheme -Replace "^(.*) \(",""
$powerScheme = $powerScheme -Replace "\)$",""
if ($details.PowerLineStatus -eq "Online") {
if ($details.BatteryChargeStatus -eq "NoSystemBattery") {
$reply = "✅ AC powered"
} elseif ($percent -ge 95) {
$reply = "✅ Battery $percent% full"
$reply = "✅ Battery nearly full ($percent%, power scheme is '$powerScheme')"
} else {
$reply = "✅ Battery charging ($percent%)"
$reply = "✅ Battery $percent% and charging (power scheme is '$powerScheme')"
}
} else { # must be offline
if (($remaining -eq 0) -and ($percent -ge 60)) {
$reply = "✅ Battery $percent% full"
$reply = "✅ Battery $percent% full (power scheme is '$powerScheme')"
} elseif ($remaining -eq 0) {
$reply = "✅ Battery at $percent%"
$reply = "✅ Battery at $percent% (power scheme is '$powerScheme')"
} elseif ($remaining -le 5) {
$reply = "⚠️ Battery at $percent% with ONLY $($remaining)min remaining"
$reply = "⚠️ Battery $percent% ONLY $($remaining)min remaining (power scheme is '$powerScheme')"
} elseif ($remaining -le 30) {
$reply = "⚠️ Battery at $percent% with only $($remaining)min remaining"
$reply = "⚠️ Battery $percent% only $($remaining)min remaining (power scheme is '$powerScheme')"
} elseif ($percent -lt 10) {
$reply = "⚠️ Battery at $percent% with $($remaining)min remaining"
} elseif ($percent -ge 80) {
$reply = "✅ Battery $percent% full with $($remaining)min remaining"
$reply = "⚠️ Battery $percent% only with $($remaining)min remaining (power scheme is '$powerScheme') "
} elseif ($percent -ge 90) {
$reply = "✅ Battery $percent% full with $($remaining)min remaining (power scheme is '$powerScheme')"
} else {
$reply = "✅ Battery at $percent% with $($remaining)min remaining"
$reply = "✅ Battery $percent% with $($remaining)min remaining (power scheme is '$powerScheme') "
}
}
$powerScheme = (powercfg /getactivescheme)
$powerScheme = $powerScheme -Replace "^(.*) \(",""
$powerScheme = $powerScheme -Replace "\)$",""
$reply += ", power scheme is '$powerScheme'"
}
Write-Host $reply
exit 0 # success
@@ -92,4 +91,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 08/15/2024 09:50:46)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 11/08/2024 12:34:47)*