@echo off setlocal EnableExtensions set "OUTDIR=%~dp0reports" set "OUT=%OUTDIR%\event-errors.txt" if not exist "%OUTDIR%" mkdir "%OUTDIR%" echo Event errors report > "%OUT%" echo Generated: %DATE% %TIME% >> "%OUT%" echo. >> "%OUT%" echo System log >> "%OUT%" wevtutil qe System /q:"*[System[(Level=1 or Level=2)]]" /c:25 /rd:true /f:text >> "%OUT%" 2>&1 echo. >> "%OUT%" echo Application log >> "%OUT%" wevtutil qe Application /q:"*[System[(Level=1 or Level=2)]]" /c:25 /rd:true /f:text >> "%OUT%" 2>&1 echo Report saved to "%OUT%" echo Journals were only read, nothing was cleared. exit /b 0