cleanup output for ticket comments
This commit is contained in:
@@ -3,7 +3,10 @@ $tempFile = New-TemporaryFile
|
||||
$(sfc.exe /scannow) | Out-File $tempFile
|
||||
Set-Content -Path $tempFile -Value $(Get-Content -Path $tempFile -Encoding Unicode) -Encoding UTF8
|
||||
$SFCOutput = Get-Content -Path $tempFile
|
||||
$TicketComment = "SFC Output:`n" + ($SFCOutput -join "`n")
|
||||
$TicketComment = "SFC Output:`n"
|
||||
ForEach ( $line in $SFCOutput ) {
|
||||
If ( $line -notmatch '^Verification \d{1,3}% 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
|
||||
|
||||
@@ -26,18 +29,14 @@ If ( IsWindowsVersion -ge "6.2" ) {
|
||||
$EndDISMRun = (Get-Date)
|
||||
|
||||
# Extract results of DISM repair from system log and add them to this log
|
||||
$TicketComment = "DISM Output:`n"
|
||||
Write-Output "Beginning Windows Component Store log data collection"
|
||||
Get-Content -Path "${Env:WinDir}\Logs\DISM\dism.log" | Select-String -Pattern '^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})' |
|
||||
ForEach-Object {
|
||||
If ( ((Get-Date $_.Line.Substring(0,19)) -gt $BeginDISMRun) -and ((Get-Date $_.Line.Substring(0,19)) -le $EndDISMRun) ) {
|
||||
$line = $_.Line
|
||||
Write-Output $line
|
||||
$TicketComment = $TicketComment + $line + "`n"
|
||||
Write-Output $_.Line
|
||||
}
|
||||
}
|
||||
Write-Output "Completed Windows Component Store log data collection"
|
||||
If ( $TicketID ) { Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body $TicketComment -Hidden $true -DoNotEmail $true }
|
||||
}
|
||||
Else { Write-Output "Online image cleanup and restoration is only supported on Windows 8 and higher" }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user