Improved check-file-system.ps1

This commit is contained in:
Markus Fleschutz 2021-04-05 11:03:12 +02:00
parent d10466f01c
commit 52e3ea66a3

View File

@ -15,9 +15,10 @@ if ($Drive -eq "" ) {
}
try {
repair-volume -driveLetter $Drive -scan
$Result = repair-volume -driveLetter $Drive -scan
if ($Result -ne "NoErrorsFound") { throw "'repair-volume' failed" }
write-host -foregroundColor green "OK - drive $Drive is non-corrupt"
write-host -foregroundColor green "OK - file system on drive $Drive is clean"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"