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