improved logic for sfc output

This commit is contained in:
2024-07-03 17:00:42 -04:00
parent 2dd6384c57
commit 6904647871
+8 -1
View File
@@ -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" ) {