diff --git a/disk_check.ps1 b/disk_check.ps1 index 43dfc56..46e69e3 100644 --- a/disk_check.ps1 +++ b/disk_check.ps1 @@ -24,18 +24,18 @@ Function Write-Log{ Write-Output "Checking disks for $($computerName)" -foreach ($i in $volumes) { - if ($i.FileSystemLabel -eq "") { +foreach ($i in $volumes.DriveLetter) { + if ($i.DriveLetter -eq "") { Write-Output "" } else { - $result=Repair-Volume -FileSystemLabel $i.FileSystemLabel -Scan + $result=Repair-Volume -FileSystemLabel $i.DriveLetter -Scan if ($result.value -gt 0) { - Repair-Volume -FileSystemLabel $i.FileSystemLabel -Scan -OfflineScanAndFix + Repair-Volume -FileSystemLabel $i.DriveLetter -Scan -OfflineScanAndFix $requireReboot = $true } else { Write-Output "$($i.FileSystemLabel): Drive is OK!" - Write-Log "$($now), $($i.FileSystemLabel), $($result), $($computerName)" + Write-Log "Date: $($now), Drive Letter: $($i.DriveLetter), Volume Name: $($i.FileSystemLabel), Result: $($result), $($computerName)" } } }