EVTX
Export Windows event logs
wevtutil epl <LOGNAME> <LOCAL_PATH | REMOTE_PATH>\<FILENAME.evtx>
wevtutil /r:<HOSTNAME | IP> /u:<DOMAIN | WORKGROUP>\<USERNAME> /p:<PASSWORD> epl <LOGNAME> <LOCAL_PATH | REMOTE_PATH>\<FILENAME.evtx>export_logs.bat "<HOSTNAME | IP>" "<OUTPUTDIR_PATH>"@echo off
REM GetEventLogs.cmd by Malcolm McCaffery
SETLOCAL ENABLEDELAYEDEXPANSION
SET remotePC=%1
SET OutputDir=%2
IF "%remotePC%" EQU "" set remotePC=%computername%
IF NOT EXIST %OutputDir% MD %OutputDir%
pushd "%OutputDir%"
echo Get Event Logs on System %remotePC%
for /F "delims=\" %%i IN ('wevtutil el /r:%remotePC%') DO (
echo Retreving Log %%i
for /F "tokens=1,2 delims=/" %%j IN ("%%i") DO (
IF "%%k" EQU "" (
SET OUTPUTFILE=%computername%-%%j.evtx
) ELSE (
SET OUTPUTFILE=%computername%-%%j-%%k.evtx
)
)
wevtutil epl "%%i" "!OUTPUTFILE!" /ow:true /r:%remotePC%
)
REM cleanup by deleting any empty event files…
for /R %%i IN (*.evtx) DO (
echo Processing %%i
REM if file is 69,632 bytes or less then delete it – don't want empty files
IF %%~zi LEQ 69632 (
echo empty event file…deleting…
del "%%i" /q
)
)
popd
echo.'
echo Completed - events stored in %OutputDir%
pauseList and query Windows event logs
Automated analysis
Last updated