m0gliE

Clear Windows Event Logs

Oct 4th, 2025 (edited)
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.43 KB | Source Code | 0 0
  1.  @echo off
  2.     FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V
  3.     IF (%adminTest%)==(Access) goto noAdmin
  4.     for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :do_clear "%%G")
  5.     echo.
  6.     echo Event Logs have been cleared!
  7.     goto theEnd
  8.     :do_clear
  9.     echo clearing %1
  10.     wevtutil.exe cl %1
  11.     goto :eof
  12.     :noAdmin
  13.     echo You must run this script as an Administrator!
  14.     echo.
  15.     :theEnd
  16. pause
Tags: windows
Advertisement
Add Comment
Please, Sign In to add comment