diff --git a/Fix-WindowsHealth.ps1 b/Fix-WindowsHealth.ps1 index 476c2f7..87b5328 100644 --- a/Fix-WindowsHealth.ps1 +++ b/Fix-WindowsHealth.ps1 @@ -11,7 +11,14 @@ New-TicketComment -Comment $TicketComment -Hidden -DoNotEmail Remove-Item $tempFile -Force -ErrorAction SilentlyContinue # Examine $SFCOutput for integrity violations, if found make sure chkdsk runs at the next boot -If ( $SFCOutput -contains 'Windows Resource Protection did not find any integrity violations.' ) { $ScheduleCheckDisk = $false } Else { $ScheduleCheckDisk = $true } +Switch ( $SFCOutput ) { + { $_ -match 'Windows Resource Protection found integrity violations' } { $ScheduleCheckDisk = $true } + { $_ -match 'Windows Resource Protection did not find any integrity violations.' } { $ScheduleCheckDisk = $false } + { $_ -match 'There is a system repair pending which requires reboot to complete.' } { + $ScheduleCheckDisk = $false + New-TicketComment -Comment "System repair is already pending. Reboot needs to occur first, then SFC should be run again." -Hidden -DoNotEmail + } +} # Run enhanced DISM for Windows 8 and higher endpoints If ( IsWindowsVersion -ge "6.2" ) {