What's the equivalent of Wevtutil in XP or 2003?

Posted by Matt on Super User See other posts from Super User or by Matt
Published on 2014-08-19T16:17:15Z Indexed on 2014/08/19 16:22 UTC
Read the original article Hit count: 322

I have a batch file for saving event logs to our shared drive. I want to do this for XP and Server 2003 without very much effort. What could I use since Wevtutil is only on Vista and up?

rem Script start here
rem Timestamp Generator

set BACKUP_PATH=\\shared-drive\it\Temp\Event-Logs\

rem Parse the date (e.g., Thu 02/28/2013)
set cur_yyyy=%date:~10,4%
set cur_mm=%date:~4,2%
set cur_dd=%date:~7,2%

rem Parse the time (e.g., 11:20:56.39)
set cur_hh=%time:~0,2%
if %cur_hh% lss 10 (set cur_hh=0%time:~1,1%)
set cur_nn=%time:~3,2%
set cur_ss=%time:~6,2%
set cur_ms=%time:~9,2%

rem Set the timestamp format
set timestamp=%cur_yyyy%%cur_mm%%cur_dd%-%cur_hh%%cur_nn%%cur_ss%%cur_ms%

rem Set the computername format
set servname=%computername%

wevtutil epl System %BACKUP_PATH%\%servname%_%timestamp%_system.evtx
wevtutil epl Application %BACKUP_PATH%\%servname%_%timestamp%_application.evtx
wevtutil epl Security %BACKUP_PATH%\%servname%_%timestamp%_security.evtx

rem End of Script

© Super User or respective owner

Related posts about windows-7

Related posts about Windows