Last active
April 1, 2019 17:30
-
-
Save mark05e/c97c0c21899d6c21e44ecfb56df1e3e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM CreateLogFolderWithEventLogs.bat | |
REM ****************************************************** | |
REM SCRIPT TO CREATE LOGS FOLDER ON DESKTOP w/ Event Logs | |
REM ****************************************************** | |
REM by Mark | |
@echo off | |
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a" | |
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%" | |
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%" | |
set "datestamp=%YYYY%%MM%%DD%" & set "timestamp=%HH%%Min%%Sec%" | |
set "fullstamp=%YYYY%%MM%%DD%__%HH%-%Min%-%Sec%" | |
echo datestamp: "%datestamp%" | |
echo timestamp: "%timestamp%" | |
echo fullstamp: "%fullstamp%" | |
cd /d %USERPROFILE%\Desktop | |
md LOGS__%COMPUTERNAME%__%fullstamp% | |
explorer LOGS__%COMPUTERNAME%__%fullstamp% | |
md LOGS__%COMPUTERNAME%__%fullstamp%\EventLogs | |
WEVTUtil export-log System LOGS__%COMPUTERNAME%__%fullstamp%\EventLogs\sys.evtx | |
WEVTUtil export-log Application LOGS__%COMPUTERNAME%__%fullstamp%\EventLogs\app.evtx | |
timeout 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment