mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-03 15:14:50 +02:00
Update check-battery.ps1 and check-ram.ps1
This commit is contained in:
parent
ae52401e98
commit
546dbdfcaf
@ -12,17 +12,21 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
Add-Type -Assembly System.Windows.Forms
|
||||
$Details = [System.Windows.Forms.SystemInformation]::PowerStatus
|
||||
switch ($Details.PowerLineStatus) {
|
||||
"Online" { $PowerStatus = "Plugged in to AC power" }
|
||||
"Offline" { $PowerStatus = "Disconnected from AC power" }
|
||||
if ($IsLinux) {
|
||||
# TODO
|
||||
} else {
|
||||
Add-Type -Assembly System.Windows.Forms
|
||||
$Details = [System.Windows.Forms.SystemInformation]::PowerStatus
|
||||
switch ($Details.PowerLineStatus) {
|
||||
"Online" { $PowerStatus = "Plugged in to AC power" }
|
||||
"Offline" { $PowerStatus = "Disconnected from AC power" }
|
||||
}
|
||||
switch ($Details.BatteryChargeStatus) {
|
||||
"NoSystemBattery" { $BatteryStatus = "no system battery" }
|
||||
default { $BatteryStatus = $Details.BatteryChargeStatus }
|
||||
}
|
||||
"✅ $PowerStatus, $BatteryStatus"
|
||||
}
|
||||
switch ($Details.BatteryChargeStatus) {
|
||||
"NoSystemBattery" { $BatteryStatus = "no system battery" }
|
||||
default { $BatteryStatus = $Details.BatteryChargeStatus }
|
||||
}
|
||||
"✅ $PowerStatus, $BatteryStatus"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -52,7 +52,7 @@ try {
|
||||
[float]$Voltage = $Bank.ConfiguredVoltage / 1000.0
|
||||
$Manufacturer = $Bank.Manufacturer
|
||||
$Location = "$($Bank.BankLabel)/$($Bank.DeviceLocator)"
|
||||
"✅ $($Capacity)GB $($Type) by $($Manufacturer): $($Speed)MHz, $($Voltage)V at $Location"
|
||||
"✅ $($Capacity)GB $($Type) at $($Location): $($Speed)MHz, $($Voltage)V by $Manufacturer"
|
||||
}
|
||||
}
|
||||
exit 0 # success
|
||||
|
Loading…
Reference in New Issue
Block a user