28 lines
858 B
Batchfile
28 lines
858 B
Batchfile
@echo off
|
|
cd /d "%~dp0..\.."
|
|
echo.
|
|
echo === Posimai PC Audit (Share-Safe) ===
|
|
echo.
|
|
echo Running audit (share-safe mode)...
|
|
call npm run audit:pc:share
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo ERROR: Audit failed.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo.
|
|
echo Opening report viewer...
|
|
powershell -NoProfile -Command ^
|
|
"$j=[System.IO.File]::ReadAllText('%~dp0out\latest.json',[System.Text.Encoding]::UTF8);" ^
|
|
"$t=[System.IO.File]::ReadAllText('%~dp0report-viewer.html',[System.Text.Encoding]::UTF8);" ^
|
|
"$s='<script>window.__AUDIT_PRELOAD__='+$j+';</script>';" ^
|
|
"$o=$t.Replace('<!-- AUDIT_PRELOAD -->',$s);" ^
|
|
"$p=[System.IO.Path]::Combine([System.IO.Path]::GetTempPath(),'pc-audit-report.html');" ^
|
|
"[System.IO.File]::WriteAllText($p,$o,[System.Text.Encoding]::UTF8);" ^
|
|
"Start-Process $p"
|
|
echo.
|
|
echo This report is safe to share with IT / engineers.
|
|
echo.
|
|
pause
|