From 0080ca28596d1ad9ba65842ef6f5d122db707372 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Wed, 16 Jun 2021 21:00:20 -0400 Subject: [PATCH] fixes --- disk_check.ps1 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/disk_check.ps1 b/disk_check.ps1 index 50a48a1..3f4355d 100644 --- a/disk_check.ps1 +++ b/disk_check.ps1 @@ -23,14 +23,18 @@ Function Write-Log{ } foreach ($i in $volumes) { - $result=Repair-Volume -FileSystemLabel $i.FileSystemLabel -Scan - - if ($result.value -gt 0) { - Repair-Volume -FileSystemLabel $i.FileSystemLabel -Scan -OfflineScanAndFix - $requireReboot = $true + if ($i.FileSystemLabel -eq "") { + Write-Output "" } else { - Write-Output $i.FileSystemLabel + ": Drive is OK!" - Write-Log $now + ',' + $i.FileSystemLabel + ',' + $result + ',' + $targetComputer + $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 $now + ',' + $i.FileSystemLabel + ',' + $result + ',' + $targetComputer + } } }