This commit is contained in:
Dandaedre 2026-09-04 13:23:01 +02:00
parent 2520b18ebe
commit 6e7a6cc6f4
1 changed files with 25 additions and 2 deletions

View File

@ -740,13 +740,36 @@ try {
Write-Section $writer 'SYSTEM FILE CHECK - VERIFY ONLY' {
if ($isAdmin) {
'[RUNNING] sfc.exe /verifyonly'
sfc.exe /verifyonly
$tempSfc = Join-Path $env:TEMP (
'winreport_sfc_' +
[guid]::NewGuid().ToString('N') +
'.txt'
)
try {
cmd.exe /c "sfc.exe /verifyonly > `"$tempSfc`" 2>&1"
if (Test-Path $tempSfc) {
$bytes = [System.IO.File]::ReadAllBytes($tempSfc)
# SFC output is commonly UTF-16LE
$text = [System.Text.Encoding]::Unicode.GetString($bytes)
$text.Trim([char]0)
}
else {
'SFC output file was not created.'
}
}
finally {
Remove-Item $tempSfc -Force -ErrorAction SilentlyContinue
}
}
else {
'Skipped: sfc /verifyonly requires an elevated session.'
}
}
Write-Section $writer 'IMPORTANT DIRECTORIES' {
$programFilesX86 = [Environment]::GetEnvironmentVariable('ProgramFiles(x86)')