eliminated disk checking errors
This commit is contained in:
parent
217bec9d9f
commit
3cef681bbc
@ -22,12 +22,11 @@ Function Write-Log{
|
|||||||
Add-Content $logFile -value $logstring
|
Add-Content $logFile -value $logstring
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Output "Checking disks for $($computerName)"
|
# function to scan the disk whether we have to use a drive letter
|
||||||
|
# (i.e. C:, D:, etc) or a filesystem label (i.e. Windows, etc.)
|
||||||
|
Function Scan-Disk{
|
||||||
|
Param ([string]$volume_identifier)
|
||||||
|
|
||||||
foreach ($i in $volumes) {
|
|
||||||
if ($i.FileSystemLabel -eq "") {
|
|
||||||
Write-Output ""
|
|
||||||
} else {
|
|
||||||
$result=Repair-Volume -DriveLetter $i.DriveLetter -Scan
|
$result=Repair-Volume -DriveLetter $i.DriveLetter -Scan
|
||||||
|
|
||||||
if ($result.value -gt 0) {
|
if ($result.value -gt 0) {
|
||||||
@ -38,6 +37,36 @@ foreach ($i in $volumes) {
|
|||||||
Write-Log "Date: $($now), Drive Letter: $($i.DriveLetter), Volume Name: $($i.FileSystemLabel), Result: $($result), $($computerName)"
|
Write-Log "Date: $($now), Drive Letter: $($i.DriveLetter), Volume Name: $($i.FileSystemLabel), Result: $($result), $($computerName)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Write-Output "Checking disks for $($computerName)"
|
||||||
|
|
||||||
|
foreach ($i in $volumes) {
|
||||||
|
if ($i.FileSystemLabel -eq $null) {
|
||||||
|
$result=Repair-Volume -DriveLetter $i.DriveLetter -Scan
|
||||||
|
|
||||||
|
if ($result.value -gt 0) {
|
||||||
|
Repair-Volume -DriveLetter $i.DriveLetter -Scan -OfflineScanAndFix
|
||||||
|
$requireReboot = $true
|
||||||
|
} else {
|
||||||
|
Write-Output "$($i.DriveLetter): Drive is OK!"
|
||||||
|
Write-Log "Date: $($now), Drive Letter: $($i.DriveLetter), Result: $($result), $($computerName)"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($i.DriveLetter -eq $null) {
|
||||||
|
Write-Output "Volume is not identifiable! Skipping..."
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
$result=Repair-Volume -FileSystemLabel $i.FileSystemLabel -Scan
|
||||||
|
|
||||||
|
if ($result.value -gt 0) {
|
||||||
|
Repair-Volume -FileSystemLabel $i.FileSystemLabel -Scan -OfflineScanAndFix
|
||||||
|
$requireReboot = $true
|
||||||
|
} else {
|
||||||
|
Write-Output "$($i.FileSystemLabel): Drive is OK!"
|
||||||
|
Write-Log "Date: $($now), Volume Name: $($i.FileSystemLabel), Result: $($result), $($computerName)"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($requireReboot -eq $true) {
|
if ($requireReboot -eq $true) {
|
||||||
|
Loading…
Reference in New Issue
Block a user