Update check-smart-devices.ps1

This commit is contained in:
Markus Fleschutz 2022-11-01 16:43:00 +01:00
parent cb53701a0a
commit cea14316e6

View File

@ -47,9 +47,7 @@ try {
continue
} elseif ($IsLinux) {
$Details = (sudo smartctl --all --json $Device) | ConvertFrom-Json
if ($lastExitCode -ne "0") { throw "'sudo smartctl --all --json $Device' exited with error code $lastExitCode" }
$null = (sudo smartctl --test=short $Device)
if ($lastExitCode -ne "0") { throw "'sudo smartctl --test=short $Device' exited with error code $lastExitCode" }
} else {
$Details = (smartctl --all --json $Device) | ConvertFrom-Json
$null = (smartctl --test=short $Device)
@ -73,4 +71,4 @@ try {
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
}