mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-13 08:19:15 +01:00
Update check-smart-devices.ps1
This commit is contained in:
parent
4730d84c84
commit
45c1b1e235
@ -35,13 +35,19 @@ try {
|
|||||||
$Details = (smartctl --all --json $Device) | ConvertFrom-Json
|
$Details = (smartctl --all --json $Device) | ConvertFrom-Json
|
||||||
}
|
}
|
||||||
$ModelName = $Details.model_name
|
$ModelName = $Details.model_name
|
||||||
$Type = $Details.device.type
|
$Protocol = $Details.device.protocol
|
||||||
[int]$Capacity = $Details.user_capacity.bytes / (1024 * 1024 * 1024)
|
[int]$GBytes = $Details.user_capacity.bytes / 1GB
|
||||||
|
if ($GBytes -eq 0) {
|
||||||
|
$Capacity = ""
|
||||||
|
} else {
|
||||||
|
$Capacity = " $GBytes GB,"
|
||||||
|
}
|
||||||
$Temp = $Details.temperature.current
|
$Temp = $Details.temperature.current
|
||||||
|
$Firmware = $Details.firmware_version
|
||||||
$PowerOn = $Details.power_cycle_count
|
$PowerOn = $Details.power_cycle_count
|
||||||
$Hours = $Details.power_on_time.hours
|
$Hours = $Details.power_on_time.hours
|
||||||
if ($Details.smart_status.passed) { $Status = "passed" } else { $Status = "NOT PASSED" }
|
if ($Details.smart_status.passed) { $Status = "passed" } else { $Status = "NOT PASSED" }
|
||||||
"✅ SMART device $ModelName ($Type), $($Capacity)GB, $($PowerOn)x on, $($Hours) hours, $($Temp)°C, $Status."
|
"✅ SMART device $ModelName ($Protocol),$Capacity v$($Firmware), $($PowerOn)x on, $($Hours) hours, $($Temp)°C, $Status."
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
Loading…
Reference in New Issue
Block a user