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,6 +12,9 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($IsLinux) {
|
||||||
|
# TODO
|
||||||
|
} else {
|
||||||
Add-Type -Assembly System.Windows.Forms
|
Add-Type -Assembly System.Windows.Forms
|
||||||
$Details = [System.Windows.Forms.SystemInformation]::PowerStatus
|
$Details = [System.Windows.Forms.SystemInformation]::PowerStatus
|
||||||
switch ($Details.PowerLineStatus) {
|
switch ($Details.PowerLineStatus) {
|
||||||
@ -23,6 +26,7 @@ try {
|
|||||||
default { $BatteryStatus = $Details.BatteryChargeStatus }
|
default { $BatteryStatus = $Details.BatteryChargeStatus }
|
||||||
}
|
}
|
||||||
"✅ $PowerStatus, $BatteryStatus"
|
"✅ $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