-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSYS-PURGE.EVENTS.cmd
36 lines (36 loc) · 1.95 KB
/
SYS-PURGE.EVENTS.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
@ECHO OFF
COLOR 1
:: *************************************************************************************************************:
:: ****************************************** PURGE EVENT LOGS SCRIPT ******************************************:
:: *************************************************************************************************************:
:: Author: JBallard (JEB) :
:: Date: 2016.10.19 :
:: Script: SYSTEM-PURGE.EVENTS.cmd :
:: Effort: A script that clears out all Event Logs from the Systems Event Viewer. :
:: Ver: 1.0 :
:: *************************************************************************************************************:
:: *************************************************************************************************************:
::
:: *****************************************:
:: STEP INTO PURGE EVENTS LOOP :
:: *****************************************:
FOR /F "tokens=1,2*" %%V IN ('BCDEDIT') DO SET Admin=%%V
IF (%Admin%)==(Access) GOTO AdminFail
:: WEVTUTIL RETRIEVES INFO ABOUT PUBLISHERS & EVENT LOGS:
FOR /F "tokens=*" %%G IN ('WEVTUTIL EL') DO (call :ClearLogs "%%G")
ECHO SUCCESSFULLY PURGED ALL EVENT LOG(s)!:
ECHO ^<PRESS SPACE BAR TO EXIT^>
GOTO ENDPURGE
:ClearLogs
ECHO CLEARING EVENT LOGS @ %1
WEVTUTIL CL %1
GOTO :EOF
:AdminFail
ECHO MUST USE ADMINISTRATIVE PRIVILEDGES!:
ECHO ^<PRESS SPACE BAR TO EXIT^>
:ENDPURGE
EXIT
::
:: *****************************************:
:: END OF SCRIPT :
:: *****************************************: