diff --git a/Fix-WindowsHealth.ps1 b/Fix-WindowsHealth.ps1 index 67e74d3..ed3f744 100644 --- a/Fix-WindowsHealth.ps1 +++ b/Fix-WindowsHealth.ps1 @@ -5,7 +5,7 @@ Set-Content -Path $tempFile -Value $(Get-Content -Path $tempFile -Encoding Unico $SFCOutput = Get-Content -Path $tempFile $TicketComment = "SFC Output:`n" ForEach ( $line in $SFCOutput ) { - If ( $line -notmatch 'Verification \d{1,2}% complete\.' ) { $TicketComment = $TicketComment + $line + "`n" } + If ( $line -notmatch 'Verification \d{1,2}% complete' ) { $TicketComment = $TicketComment + $line + "`n" } } If ( $TicketID ) { Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body $TicketComment -Hidden $true -DoNotEmail $true } Remove-Item $tempFile -Force -ErrorAction SilentlyContinue @@ -44,10 +44,17 @@ Else { Write-Output "Online image cleanup and restoration is only supported on W If ( $ScheduleCheckDisk ) { Write-Output "Scheduling disk repair at next boot" Start-Process "cmd.exe" -ArgumentList '/C echo y | chkdsk /F /R /X' -Wait - $TicketComment = "Scheduled disk repair at next boot" If ( $TicketID ) { + $TicketComment = "Scheduled disk repair at next boot" Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body $TicketComment -Hidden $true -DoNotEmail $true $TicketComment = "I've made some changes that will require you to restart your computer.`n`nWhenver you're ready, please restart your computer and allow it 30min to complete the startup process." Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body $TicketComment -Hidden $false -DoNotEmail $false } +} Else { + If ( $TicketID ) { + $TicketComment = "Disk check was not scheduled to run, as no Windows integrity violations were found." + Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body $TicketComment -Hidden $true -DoNotEmail $true + $TicketComment = "Your computer has been repaired. Please restart your computer as soon as you're able." + Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body $TicketComment -Hidden $false -DoNotEmail $false + } } \ No newline at end of file