diff --git a/scripts/check-drives.ps1 b/scripts/check-drives.ps1 index d712b8d2..fc938166 100755 --- a/scripts/check-drives.ps1 +++ b/scripts/check-drives.ps1 @@ -7,8 +7,8 @@ Specifies the minimum warning level (10GB by default) .EXAMPLE PS> ./check-drives.ps1 - ✅ Drive C: at 49% of 1TB - 512GB free - ✅ Drive D: at 84% of 4TB - 641GB free + ✅ C: at 49% of 1TB - 512GB free + ✅ D: at 84% of 4TB - 641GB free .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -39,14 +39,14 @@ try { [int64]$total = ($used + $free) if ($total -eq 0) { - Write-Host "✅ Drive $name is empty" + Write-Host "✅ $name is empty" } elseif ($free -eq 0) { - Write-Host "⚠️ Drive $name with $(Bytes2String $total) is full" + Write-Host "⚠️ $name with $(Bytes2String $total) is full" } elseif ($free -lt $minLevel) { - Write-Host "⚠️ Drive $name with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free" + Write-Host "⚠️ $name with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free" } else { [int64]$percent = ($used * 100) / $total - Write-Host "✅ Drive $name at $percent% of $(Bytes2String $total) - $(Bytes2String $free) free" + Write-Host "✅ $name at $percent% of $(Bytes2String $total) - $(Bytes2String $free) free" } } exit 0 # success diff --git a/scripts/check-power.ps1 b/scripts/check-power.ps1 index f9c80113..0a0256d7 100755 --- a/scripts/check-power.ps1 +++ b/scripts/check-power.ps1 @@ -5,7 +5,7 @@ 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 at 9% with power scheme 'HP Optimized' - 54min remaining .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -20,35 +20,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 '$powerScheme')" } else { - $reply = "✅ Battery charging ($percent%)" + $reply = "✅ Battery charging ($percent%, power scheme '$powerScheme')" } } else { # must be offline if (($remaining -eq 0) -and ($percent -ge 60)) { - $reply = "✅ Battery $percent% full" + $reply = "✅ Battery $percent% full (power scheme '$powerScheme')" } elseif ($remaining -eq 0) { - $reply = "✅ Battery at $percent%" + $reply = "✅ Battery at $percent% (power scheme '$powerScheme')" } elseif ($remaining -le 5) { - $reply = "⚠️ Battery at $percent% with ONLY $($remaining)min remaining" + $reply = "⚠️ Battery at $percent% (power scheme '$powerScheme') - ONLY $($remaining)min remaining" } elseif ($remaining -le 30) { - $reply = "⚠️ Battery at $percent% with only $($remaining)min remaining" + $reply = "⚠️ Battery at $percent% (power scheme '$powerScheme') - only $($remaining)min remaining" } elseif ($percent -lt 10) { - $reply = "⚠️ Battery at $percent% with $($remaining)min remaining" + $reply = "⚠️ Battery at $percent% (power scheme '$powerScheme') - $($remaining)min remaining" } elseif ($percent -ge 80) { - $reply = "✅ Battery $percent% full with $($remaining)min remaining" + $reply = "✅ Battery $percent% full (power scheme '$powerScheme') - $($remaining)min remaining" } else { - $reply = "✅ Battery at $percent% with $($remaining)min remaining" + $reply = "✅ Battery at $percent% (power scheme '$powerScheme') - $($remaining)min remaining" } } - $powerScheme = (powercfg /getactivescheme) - $powerScheme = $powerScheme -Replace "^(.*) \(","" - $powerScheme = $powerScheme -Replace "\)$","" - $reply += ", power scheme is '$powerScheme'" } Write-Host $reply exit 0 # success