Update check-smart-devices.ps1

This commit is contained in:
Markus Fleschutz 2022-10-29 18:25:55 +02:00
parent 2de3ecc59c
commit 6e972bb5d3

View File

@ -52,9 +52,7 @@ try {
if ($lastExitCode -ne "0") { throw "'sudo smartctl --test=short $Device' exited with error code $lastExitCode" }
} else {
$Details = (smartctl --all --json $Device) | ConvertFrom-Json
if ($lastExitCode -ne "0") { throw "'smartctl --all --json $Device' exited with error code $lastExitCode" }
$null = (smartctl --test=short $Device)
if ($lastExitCode -ne "0") { throw "'smartctl --test=short $Device' exited with error code $lastExitCode" }
}
$ModelName = $Details.model_name
$Protocol = $Details.device.protocol